Java Code Examples for org.xwalk.core.XWalkView#addJavascriptInterface()

The following examples show how to use org.xwalk.core.XWalkView#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: XWalkWebViewEngine.java    From cordova-crosswalk-engine with Apache License 2.0 4 votes vote down vote up
private static void exposeJsInterface(XWalkView webView, CordovaBridge bridge) {
    XWalkExposedJsApi exposedJsApi = new XWalkExposedJsApi(bridge);
    webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}
 
Example 2
Source File: EmbeddedBrowserActivity.java    From medic-android with GNU Affero General Public License v3.0 3 votes vote down vote up
@SuppressLint("SetJavaScriptEnabled")
private void enableJavascript(XWalkView container) {
	container.getSettings().setJavaScriptEnabled(true);

	MedicAndroidJavascript maj = new MedicAndroidJavascript(this);
	maj.setAlert(new Alert(this));

	maj.setLocationManager((LocationManager) this.getSystemService(Context.LOCATION_SERVICE));

	maj.setActivityManager((ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE));

	maj.setConnectivityManager((ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE));

	container.addJavascriptInterface(maj, "medicmobile_android");
}