Example usage for org.apache.cordova CordovaPlugin initialize

List of usage examples for org.apache.cordova CordovaPlugin initialize

Introduction

In this page you can find the example usage for org.apache.cordova CordovaPlugin initialize.

Prototype

public void initialize(CordovaInterface cordova, CordovaWebView webView) 

Source Link

Document

Called after plugin construction and fields have been initialized.

Usage

From source file:plugin.google.maps.GoogleMaps.java

@SuppressWarnings("rawtypes")
private void loadPlugin(String serviceName) {
    if (plugins.containsKey(serviceName)) {
        return;/* w ww .j  av a2  s  .  c o  m*/
    }
    try {
        String className = "plugin.google.maps.Plugin" + serviceName;
        Class pluginCls = Class.forName(className);

        CordovaPlugin plugin = (CordovaPlugin) pluginCls.newInstance();
        PluginEntry pluginEntry = new PluginEntry("GoogleMaps", plugin);
        this.plugins.put(serviceName, pluginEntry);

        plugin.privateInitialize(className, this.cordova, webView, null);

        plugin.initialize(this.cordova, webView);
        ((MyPluginInterface) plugin).setMapCtrl(this);
        if (map == null) {
            Log.e(TAG, "map is null!");
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
}