You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/12/30 16:50:28 UTC
docs commit: [CB-5419] Add plugin instantiation and lifetime section.
Updated Branches:
refs/heads/master 80c8d81c4 -> 5c3c290fd
[CB-5419] Add plugin instantiation and lifetime section.
Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/5c3c290f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/5c3c290f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/5c3c290f
Branch: refs/heads/master
Commit: 5c3c290fde95b9e31f9f004e6ec2f9050f1d81a2
Parents: 80c8d81
Author: AxelNennker <ax...@nennker.de>
Authored: Sat Nov 16 10:35:19 2013 +0100
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Dec 30 10:50:05 2013 -0500
----------------------------------------------------------------------
docs/en/edge/guide/platforms/android/plugin.md | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/5c3c290f/docs/en/edge/guide/platforms/android/plugin.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/guide/platforms/android/plugin.md b/docs/en/edge/guide/platforms/android/plugin.md
index 77902fc..21c71a4 100644
--- a/docs/en/edge/guide/platforms/android/plugin.md
+++ b/docs/en/edge/guide/platforms/android/plugin.md
@@ -64,6 +64,26 @@ The service name matches the one used in the JavaScript `exec` call.
The value is the Java class's fully qualified namespace identifier.
Otherwise, the plugin may compile but still be unavailable to Cordova.
+## Plugin Initialization and Lifetime
+
+One instance of a plugin object is created for the life of each
+`WebView`. Plugins are not instantiated until they are first
+referenced by a call from JavaScript, unless `<param>` with an `onload`
+`name` attribute is set to `"true"` in `config.xml`. E.g.:
+
+ <feature name="Echo">
+ <param name="android-package" value="<full_name_including_namespace>" />
+ <param name="onload" value="true" />
+ </feature>
+
+Plugins should use the `initialize` method for their start-up logic.
+
+ @override
+ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
+ super.initialize(cordova, webView);
+ // your init code here
+ }
+
## Writing an Android Java Plugin
A JavaScript call fires off a plugin request to the native side, and