Example usage for org.apache.cordova CoreAndroid PLUGIN_NAME

List of usage examples for org.apache.cordova CoreAndroid PLUGIN_NAME

Introduction

In this page you can find the example usage for org.apache.cordova CoreAndroid PLUGIN_NAME.

Prototype

String PLUGIN_NAME

To view the source code for org.apache.cordova CoreAndroid PLUGIN_NAME.

Click Source Link

Usage

From source file:org.crosswalk.engine.XWalkCordovaWebViewImpl.java

License:Apache License

@Override
public void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences) {
    if (this.cordova != null) {
        throw new IllegalStateException();
    }//from w ww . j  av  a 2  s  .  c  o m
    this.cordova = cordova;
    this.preferences = preferences;
    pluginManager = new PluginManager(this, this.cordova, pluginEntries);
    resourceApi = new CordovaResourceApi(engine.getView().getContext(), pluginManager);
    nativeToJsMessageQueue = new NativeToJsMessageQueue();
    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.NoOpBridgeMode());
    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.LoadUrlBridgeMode(engine, cordova));

    if (preferences.getBoolean("DisallowOverscroll", false)) {
        engine.getView().setOverScrollMode(View.OVER_SCROLL_NEVER);
    }
    engine.init(this, cordova, engineClient, resourceApi, pluginManager, nativeToJsMessageQueue);
    // This isn't enforced by the compiler, so assert here.
    assert engine.getView() instanceof CordovaWebViewEngine.EngineView;

    pluginManager.addService(CoreAndroid.PLUGIN_NAME, "org.apache.cordova.CoreAndroid");
    pluginManager.init();

}

From source file:org.crosswalk.engine.XWalkCordovaWebViewImpl.java

License:Apache License

private void sendJavascriptEvent(String event) {
    if (appPlugin == null) {
        appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME);
    }/*from  www .j a  v a  2 s .  co m*/

    if (appPlugin == null) {
        LOG.w(TAG, "Unable to fire event without existing plugin");
        return;
    }
    appPlugin.fireJavascriptEvent(event);
}