Add @JavascriptInterface annotations to ExposedJsApi.

And re-enable the JS bridge on 4.2.
https://issues.apache.org/jira/browse/CB-1879
This commit is contained in:
Andrew Grieve 2012-11-22 12:39:18 -05:00
parent 92d69e320f
commit 3566154cd0
2 changed files with 4 additions and 4 deletions

View File

@ -302,10 +302,6 @@ public class CordovaWebView extends WebView {
Log.i(TAG, "Disabled addJavascriptInterface() bridge callback due to a bug on the 2.3 emulator");
return;
}
else if (SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) {
Log.i(TAG, "Disabled addJavascriptInterface() bridge callback for 4.2. Symbols are broken, and we can't compile the annotation needed to expose the exec.");
return;
}
this.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}

View File

@ -18,6 +18,7 @@
*/
package org.apache.cordova;
import android.webkit.JavascriptInterface;
import org.apache.cordova.api.PluginManager;
import org.apache.cordova.api.PluginResult;
import org.json.JSONException;
@ -37,6 +38,7 @@ import org.json.JSONException;
this.jsMessageQueue = jsMessageQueue;
}
@JavascriptInterface
public String exec(String service, String action, String callbackId, String arguments) throws JSONException {
jsMessageQueue.setPaused(true);
try {
@ -51,10 +53,12 @@ import org.json.JSONException;
}
}
@JavascriptInterface
public void setNativeToJsBridgeMode(int value) {
jsMessageQueue.setBridgeMode(value);
}
@JavascriptInterface
public String retrieveJsMessages() {
return jsMessageQueue.popAndEncode();
}