Java Code Examples for com.tencent.smtt.sdk.WebView#addJavascriptInterface()

The following examples show how to use com.tencent.smtt.sdk.WebView#addJavascriptInterface() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: X5WebViewEngine.java    From x5webview-cordova-plugin with Apache License 2.0 5 votes vote down vote up
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
    if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
        Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
        // Bug being that Java Strings do not get converted to JS strings automatically.
        // This isn't hard to work-around on the JS side, but it's easier to just
        // use the prompt bridge instead.
        return;
    }
    X5ExposedJsApi exposedJsApi = new X5ExposedJsApi(bridge);
    webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}
 
Example 2
Source File: X5WebViewEngine.java    From cordova-plugin-x5-webview with Apache License 2.0 5 votes vote down vote up
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
    if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
        LOG.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
        // Bug being that Java Strings do not get converted to JS strings automatically.
        // This isn't hard to work-around on the JS side, but it's easier to just
        // use the prompt bridge instead.
        return;
    }
    X5ExposedJsApi exposedJsApi = new X5ExposedJsApi(bridge);
    webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}
 
Example 3
Source File: X5WebViewEngine.java    From cordova-plugin-x5-tbs with Apache License 2.0 5 votes vote down vote up
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
  if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
    Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
    // Bug being that Java Strings do not get converted to JS strings automatically.
    // This isn't hard to work-around on the JS side, but it's easier to just
    // use the prompt bridge instead.
    return;
  }
  X5ExposedJsApi exposedJsApi = new X5ExposedJsApi(bridge);
  webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}
 
Example 4
Source File: X5WebViewEngine.java    From cordova-plugin-x5engine-webview with Apache License 2.0 5 votes vote down vote up
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
    if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
        Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
        // Bug being that Java Strings do not get converted to JS strings automatically.
        // This isn't hard to work-around on the JS side, but it's easier to just
        // use the prompt bridge instead.
        return;
    }
    X5ExposedJsApi exposedJsApi = new X5ExposedJsApi(bridge);
    webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}