diff --git a/bin/templates/project/assets/www/cordova.js b/bin/templates/project/assets/www/cordova.js index a7a9c0af..700c667f 100644 --- a/bin/templates/project/assets/www/cordova.js +++ b/bin/templates/project/assets/www/cordova.js @@ -901,7 +901,7 @@ var cordova = require('cordova'), EVAL_BRIDGE: 3 }, jsToNativeBridgeMode, // Set lazily. - nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE, + nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT, pollEnabled = false, bridgeSecret = -1; diff --git a/cordova-js-src/exec.js b/cordova-js-src/exec.js index eab81c02..197fb5df 100644 --- a/cordova-js-src/exec.js +++ b/cordova-js-src/exec.js @@ -55,7 +55,7 @@ var cordova = require('cordova'), EVAL_BRIDGE: 3 }, jsToNativeBridgeMode, // Set lazily. - nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE, + nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT, pollEnabled = false, bridgeSecret = -1; diff --git a/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java b/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java index c0ea94ac..84cb05ac 100755 --- a/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java +++ b/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java @@ -117,7 +117,8 @@ public class SystemWebViewEngine implements CordovaWebViewEngine { SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r); } })); - nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova)); + if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) + nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova)); bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue); exposeJsInterface(webView, bridge); } @@ -336,6 +337,12 @@ public class SystemWebViewEngine implements CordovaWebViewEngine { @Override public void evaluateJavascript(String js, ValueCallback callback) { - webView.evaluateJavascript(js, callback); + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + webView.evaluateJavascript(js, callback); + } + else + { + LOG.d(TAG, "This webview is using the old bridge"); + } } }