You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mw...@apache.org on 2013/10/22 00:13:48 UTC

[06/14] docs commit: [CB-3825] reorg advanced android plugin content

[CB-3825] reorg advanced android plugin content


Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/1d575e0d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/1d575e0d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/1d575e0d

Branch: refs/heads/master
Commit: 1d575e0dd5999babb6012336378e81442e7ef7f4
Parents: c96e9d3
Author: Mike Sierra <ms...@adobe.com>
Authored: Tue Oct 8 09:07:32 2013 -0400
Committer: Michael Brooks <mi...@michaelbrooks.ca>
Committed: Mon Oct 21 15:11:54 2013 -0700

----------------------------------------------------------------------
 docs/en/edge/guide/hybrid/plugins/index.md     |  5 +++
 docs/en/edge/guide/platforms/android/plugin.md | 48 +++++++++------------
 2 files changed, 26 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/1d575e0d/docs/en/edge/guide/hybrid/plugins/index.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/guide/hybrid/plugins/index.md b/docs/en/edge/guide/hybrid/plugins/index.md
index 8c748cb..37de077 100644
--- a/docs/en/edge/guide/hybrid/plugins/index.md
+++ b/docs/en/edge/guide/hybrid/plugins/index.md
@@ -36,6 +36,11 @@ basic plugin structure and the outward-facing JavaScript interface.
 For each corresponding native interface, see the list at the end of
 this section.
 
+In addition to these instructions, when preparing to write a plugin it
+is best to look over
+[existing plugins](https://github.com/apache/cordova-android/tree/master/framework/src/org/apache/cordova)
+for guidance.
+
 ## Building a Plugin
 
 Application developers use the CLI's `plugin add` command (discussed

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/1d575e0d/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 51b782e..a6d34f6 100644
--- a/docs/en/edge/guide/platforms/android/plugin.md
+++ b/docs/en/edge/guide/platforms/android/plugin.md
@@ -22,6 +22,8 @@ license: Licensed to the Apache Software Foundation (ASF) under one
 The section provides details for how to implement plugin code on the
 Android platform. See Application Plugins for an overview of how to
 structure the plugin and implement its common JavaScript interface.
+See also the comments in
+[CordovaPlugin.java](https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java) for sample code.
 
 Android plugins are based on Cordova-Android, which consists of an
 Android WebView with hooks attached to it.  Plugins are represented as
@@ -51,7 +53,8 @@ additional arguments passed in the `args` array.
 Whether you distribute a plugin as Java file or as a _jar_ file of its
 own, the plugin must be specified in your Cordova-Android
 application's `res/xml/config.xml` file. See Application Plugins for
-more information.
+more information on how to use the `plugin.xml` file to inject this
+`feature` element:
 
         <feature name="<service_name>">
             <param name="android-package" value="<full_name_including_namespace>" />
@@ -194,33 +197,24 @@ callback.  If the various checks pass, the `callbackContext.success()`
 passes the original `message` string back to JavaScript's success
 callback as a parameter.
 
-## Debugging Android Plugins
-
-You can use Eclipse to debug plugins as Java source included in the
-project.  Only the latest version of the Android Developer Tools is
-known to allow source code attachment to _JAR_ dependencies, so this
-is not yet fully supported.
-
-## Common Pitfalls
+## Android Integration
 
-- Plugins have access to a `CordovaInterface` object. This object has
-  access to the Android `Activity` that is running the application.
-  This is the `Context` required to launch a new Android `Intent`. The
-  `CordovaInterface` allows plugins to start an `Activity` for a
-  result, and to set the callback plugin for when the `Intent` comes
-  back to the application. This is important, since the `Intent`s
-  system is how Android communicates between processes.
+Android features an `Intent` system that allows processes to
+communicate with each other.  Plugins have access to a
+`CordovaInterface` object, which can access the Android `Activity`
+that runs the application.  This is the `Context` required to launch a
+new Android `Intent`.  The `CordovaInterface` allows plugins to start
+an `Activity` for a result, and to set the callback plugin for when
+the `Intent` returns to the application.
 
-- Plugins do not have direct access to the `Context` as they have in
-  the past. The legacy `ctx` member is deprecated, and will be removed
-  six months after 2.0 is released. All of `ctx` methods exist on the
-  `Context`, so both `getContext()` and `getActivity()` are capable of
-  returning the proper object required.
+As of Cordova 2.0, Plugins can no longer directly access the
+`Context`, and the legacy `ctx` member is deprecated. All `ctx`
+methods exist on the `Context`, so both `getContext()` and
+`getActivity()` can return the required object.
 
-## Use the Source
-
-One of the best ways to prepare yourself to write your own plugin is to
-[look over existing plugins](https://github.com/search?q=%40apache+cordova-plugin).
+## Debugging Android Plugins
 
-You should also read through the comments in
-[CordovaPlugin.java](https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java).
+Eclipse allows you to debug plugins as Java source included in the
+project.  Only the latest version of the Android Developer Tools
+allows you to attach source code to _JAR_ dependencies, so this
+feature is not yet fully supported.