You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2013/08/22 19:13:03 UTC
docs commit: CB-4353: Updating documentation
Updated Branches:
refs/heads/master f792d76af -> 7cec63347
CB-4353: Updating documentation
Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/7cec6334
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/7cec6334
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/7cec6334
Branch: refs/heads/master
Commit: 7cec63347ab4384854ea1559845cd34102e81327
Parents: f792d76
Author: Joe Bowser <bo...@apache.org>
Authored: Thu Aug 22 10:12:37 2013 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 22 10:12:37 2013 -0700
----------------------------------------------------------------------
docs/en/2.9.0/guide/cordova-webview/android.md | 120 +++++++++----------
.../en/3.0.0/guide/platforms/android/webview.md | 106 ++++++++--------
docs/en/edge/guide/platforms/android/webview.md | 106 ++++++++--------
3 files changed, 164 insertions(+), 168 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/7cec6334/docs/en/2.9.0/guide/cordova-webview/android.md
----------------------------------------------------------------------
diff --git a/docs/en/2.9.0/guide/cordova-webview/android.md b/docs/en/2.9.0/guide/cordova-webview/android.md
index fa439fd..c3eb8f8 100644
--- a/docs/en/2.9.0/guide/cordova-webview/android.md
+++ b/docs/en/2.9.0/guide/cordova-webview/android.md
@@ -17,15 +17,14 @@ license: Licensed to the Apache Software Foundation (ASF) under one
under the License.
---
-Embedding Cordova WebView on Android
-====================================
+# Android WebViews
Beginning in Cordova 1.9, with the assistance of the
`CordovaActivity`, you can use Cordova as a component in a larger
native Android application. Android refers to this component as the
`CordovaWebView`. New Cordova-based applications from 1.9 onwards use
the `CordovaWebView` as its main view, regardless of whether the
-legacy `DroidGap` approach is used.
+legacy `CordovaActivity` approach is used.
If you're unfamiliar with Android application development, please read
the Android Platform Guide to developing a Cordova Application before
@@ -33,26 +32,26 @@ attempting to include a WebView. It's not the main way to author
Android Cordova applications. These instructions are currently manual,
but may be eventually be automated.
-Prerequisites
--------------
+## Prerequisites
-1. **Cordova 1.9** or greater
-2. Android SDK updated with 15
+* Cordova 1.9 or greater
-Guide to using CordovaWebView in an Android Project
----------------------------------------------------
+* Android SDK updated to the latest SDK
-1. Use `bin/create` to fetch the `commons-codec-1.6.jar` file.
-2. `cd` into `/framework` and run `ant jar` to build the cordova jar. It creates the .jar file formed as `cordova-x.x.x.jar` in the `/framework` folder.
-3. Copy the cordova jar into your Android project's `/libs` directory.
-4. Edit your application's `main.xml` file (under `/res/xml`) to look like the following, with the `layout_height`, `layout_width` and `id` modified to suit your application:
+## Guide to using CordovaWebView in an Android Project
+
+1. `cd` into `/framework` and run `ant jar` to build the cordova jar. It creates the .jar file formed as `cordova-x.x.x.jar` in the `/framework` directory.
+
+2. Copy the cordova jar into your Android project's `/libs` directory.
+
+3. Edit your application's `main.xml` file (under `/res/xml`) to look like the following, with the `layout_height`, `layout_width` and `id` modified to suit your application:
<org.apache.cordova.CordovaWebView
android:id="@+id/tutorialView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
-5. Modify your activity so that it implements the `CordovaInterface`. You should implement the included methods. You may wish to copy them from `/framework/src/org/apache/cordova/DroidGap.java`, or implement them on your own. The code fragment below shows a basic application that uses the interface. Note how the referenced view id matches the `id` attribute specified in the XML fragment shown above:
+4. Modify your activity so that it implements the `CordovaInterface`. You should implement the included methods. You may wish to copy them from `/framework/src/org/apache/cordova/CordovaActivity.java`, or implement them on your own. The code fragment below shows a basic application that uses the interface. Note how the referenced view id matches the `id` attribute specified in the XML fragment shown above:
public class CordovaViewTestActivity extends Activity implements CordovaInterface {
CordovaWebView cwv;
@@ -66,57 +65,58 @@ Guide to using CordovaWebView in an Android Project
cwv.loadUrl(Config.getStartUrl());
}
- If you use the camera, you should also implement this:
-
- @Override
- public void setActivityResultCallback(CordovaPlugin plugin) {
- this.activityResultCallback = plugin;
- }
- /**
- * Launch an activity for which you would like a result when it finished. When this activity exits,
- * your onActivityResult() method is called.
- *
- * @param command The command object
- * @param intent The intent to start
- * @param requestCode The request code that is passed to callback to identify the activity
- */
- public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode) {
- this.activityResultCallback = command;
- this.activityResultKeepRunning = this.keepRunning;
-
- // If multitasking turned on, then disable it for activities that return results
- if (command != null) {
- this.keepRunning = false;
+If you use the camera, you should also implement this:
+
+ @Override
+ public void setActivityResultCallback(CordovaPlugin plugin) {
+ this.activityResultCallback = plugin;
}
+ /**
+ * Launch an activity for which you would like a result when it finished. When this activity exits,
+ * your onActivityResult() method is called.
+ *
+ * @param command The command object
+ * @param intent The intent to start
+ * @param requestCode The request code that is passed to callback to identify the activity
+ */
+ public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode) {
+ this.activityResultCallback = command;
+ this.activityResultKeepRunning = this.keepRunning;
+
+ // If multitasking turned on, then disable it for activities that return results
+ if (command != null) {
+ this.keepRunning = false;
+ }
- // Start activity
- super.startActivityForResult(intent, requestCode);
- }
+ // Start activity
+ super.startActivityForResult(intent, requestCode);
+ }
- @Override
- /**
- * Called when an activity you launched exits, giving you the requestCode you started it with,
- * the resultCode it returned, and any additional data from it.
- *
- * @param requestCode The request code originally supplied to startActivityForResult(),
- * allowing you to identify who this result came from.
- * @param resultCode The integer result code returned by the child activity through its setResult().
- * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
- */
- protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
- super.onActivityResult(requestCode, resultCode, intent);
- CordovaPlugin callback = this.activityResultCallback;
- if (callback != null) {
- callback.onActivityResult(requestCode, resultCode, intent);
+ @Override
+ /**
+ * Called when an activity you launched exits, giving you the requestCode you started it with,
+ * the resultCode it returned, and any additional data from it.
+ *
+ * @param requestCode The request code originally supplied to startActivityForResult(),
+ * allowing you to identify who this result came from.
+ * @param resultCode The integer result code returned by the child activity through its setResult().
+ * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
+ */
+ protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ super.onActivityResult(requestCode, resultCode, intent);
+ CordovaPlugin callback = this.activityResultCallback;
+ if (callback != null) {
+ callback.onActivityResult(requestCode, resultCode, intent);
+ }
}
- }
- Finally, remember to add the thread pool, otherwise the plugins have no threads to run on:
+Finally, remember to add the thread pool, otherwise the plugins have no threads to run on:
- @Override
- public ExecutorService getThreadPool() {
- return threadPool;
- }
+ @Override
+ public ExecutorService getThreadPool() {
+ return threadPool;
+ }
6. Copy your application's HTML and JavaScript files to your Android project's `/assets/www` directory.
-7. Copy `cordova.xml` and `plugins.xml` from `/framework/res/xml` to your project's `/res/xml` folder.
+
+7. Copy `config.xml` from `/framework/res/xml` to your project's `/res/xml` directory.
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/7cec6334/docs/en/3.0.0/guide/platforms/android/webview.md
----------------------------------------------------------------------
diff --git a/docs/en/3.0.0/guide/platforms/android/webview.md b/docs/en/3.0.0/guide/platforms/android/webview.md
index dd45a33..c3eb8f8 100644
--- a/docs/en/3.0.0/guide/platforms/android/webview.md
+++ b/docs/en/3.0.0/guide/platforms/android/webview.md
@@ -24,7 +24,7 @@ Beginning in Cordova 1.9, with the assistance of the
native Android application. Android refers to this component as the
`CordovaWebView`. New Cordova-based applications from 1.9 onwards use
the `CordovaWebView` as its main view, regardless of whether the
-legacy `DroidGap` approach is used.
+legacy `CordovaActivity` approach is used.
If you're unfamiliar with Android application development, please read
the Android Platform Guide to developing a Cordova Application before
@@ -36,24 +36,22 @@ but may be eventually be automated.
* Cordova 1.9 or greater
-* Android SDK updated with 15
+* Android SDK updated to the latest SDK
## Guide to using CordovaWebView in an Android Project
-1. Use `bin/create` to fetch the `commons-codec-1.6.jar` file.
+1. `cd` into `/framework` and run `ant jar` to build the cordova jar. It creates the .jar file formed as `cordova-x.x.x.jar` in the `/framework` directory.
-2. `cd` into `/framework` and run `ant jar` to build the cordova jar. It creates the .jar file formed as `cordova-3.0.0.jar` in the `/framework` directory.
+2. Copy the cordova jar into your Android project's `/libs` directory.
-3. Copy the cordova jar into your Android project's `/libs` directory.
-
-4. Edit your application's `main.xml` file (under `/res/xml`) to look like the following, with the `layout_height`, `layout_width` and `id` modified to suit your application:
+3. Edit your application's `main.xml` file (under `/res/xml`) to look like the following, with the `layout_height`, `layout_width` and `id` modified to suit your application:
<org.apache.cordova.CordovaWebView
android:id="@+id/tutorialView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
-5. Modify your activity so that it implements the `CordovaInterface`. You should implement the included methods. You may wish to copy them from `/framework/src/org/apache/cordova/DroidGap.java`, or implement them on your own. The code fragment below shows a basic application that uses the interface. Note how the referenced view id matches the `id` attribute specified in the XML fragment shown above:
+4. Modify your activity so that it implements the `CordovaInterface`. You should implement the included methods. You may wish to copy them from `/framework/src/org/apache/cordova/CordovaActivity.java`, or implement them on your own. The code fragment below shows a basic application that uses the interface. Note how the referenced view id matches the `id` attribute specified in the XML fragment shown above:
public class CordovaViewTestActivity extends Activity implements CordovaInterface {
CordovaWebView cwv;
@@ -67,58 +65,58 @@ but may be eventually be automated.
cwv.loadUrl(Config.getStartUrl());
}
- If you use the camera, you should also implement this:
-
- @Override
- public void setActivityResultCallback(CordovaPlugin plugin) {
- this.activityResultCallback = plugin;
- }
- /**
- * Launch an activity for which you would like a result when it finished. When this activity exits,
- * your onActivityResult() method is called.
- *
- * @param command The command object
- * @param intent The intent to start
- * @param requestCode The request code that is passed to callback to identify the activity
- */
- public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode) {
- this.activityResultCallback = command;
- this.activityResultKeepRunning = this.keepRunning;
-
- // If multitasking turned on, then disable it for activities that return results
- if (command != null) {
- this.keepRunning = false;
+If you use the camera, you should also implement this:
+
+ @Override
+ public void setActivityResultCallback(CordovaPlugin plugin) {
+ this.activityResultCallback = plugin;
}
+ /**
+ * Launch an activity for which you would like a result when it finished. When this activity exits,
+ * your onActivityResult() method is called.
+ *
+ * @param command The command object
+ * @param intent The intent to start
+ * @param requestCode The request code that is passed to callback to identify the activity
+ */
+ public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode) {
+ this.activityResultCallback = command;
+ this.activityResultKeepRunning = this.keepRunning;
+
+ // If multitasking turned on, then disable it for activities that return results
+ if (command != null) {
+ this.keepRunning = false;
+ }
- // Start activity
- super.startActivityForResult(intent, requestCode);
- }
+ // Start activity
+ super.startActivityForResult(intent, requestCode);
+ }
- @Override
- /**
- * Called when an activity you launched exits, giving you the requestCode you started it with,
- * the resultCode it returned, and any additional data from it.
- *
- * @param requestCode The request code originally supplied to startActivityForResult(),
- * allowing you to identify who this result came from.
- * @param resultCode The integer result code returned by the child activity through its setResult().
- * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
- */
- protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
- super.onActivityResult(requestCode, resultCode, intent);
- CordovaPlugin callback = this.activityResultCallback;
- if (callback != null) {
- callback.onActivityResult(requestCode, resultCode, intent);
+ @Override
+ /**
+ * Called when an activity you launched exits, giving you the requestCode you started it with,
+ * the resultCode it returned, and any additional data from it.
+ *
+ * @param requestCode The request code originally supplied to startActivityForResult(),
+ * allowing you to identify who this result came from.
+ * @param resultCode The integer result code returned by the child activity through its setResult().
+ * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
+ */
+ protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ super.onActivityResult(requestCode, resultCode, intent);
+ CordovaPlugin callback = this.activityResultCallback;
+ if (callback != null) {
+ callback.onActivityResult(requestCode, resultCode, intent);
+ }
}
- }
- Finally, remember to add the thread pool, otherwise the plugins have no threads to run on:
+Finally, remember to add the thread pool, otherwise the plugins have no threads to run on:
- @Override
- public ExecutorService getThreadPool() {
- return threadPool;
- }
+ @Override
+ public ExecutorService getThreadPool() {
+ return threadPool;
+ }
6. Copy your application's HTML and JavaScript files to your Android project's `/assets/www` directory.
-7. Copy `cordova.xml` and `plugins.xml` from `/framework/res/xml` to your project's `/res/xml` directory.
+7. Copy `config.xml` from `/framework/res/xml` to your project's `/res/xml` directory.
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/7cec6334/docs/en/edge/guide/platforms/android/webview.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/guide/platforms/android/webview.md b/docs/en/edge/guide/platforms/android/webview.md
index 30aa4ed..c3eb8f8 100644
--- a/docs/en/edge/guide/platforms/android/webview.md
+++ b/docs/en/edge/guide/platforms/android/webview.md
@@ -24,7 +24,7 @@ Beginning in Cordova 1.9, with the assistance of the
native Android application. Android refers to this component as the
`CordovaWebView`. New Cordova-based applications from 1.9 onwards use
the `CordovaWebView` as its main view, regardless of whether the
-legacy `DroidGap` approach is used.
+legacy `CordovaActivity` approach is used.
If you're unfamiliar with Android application development, please read
the Android Platform Guide to developing a Cordova Application before
@@ -36,24 +36,22 @@ but may be eventually be automated.
* Cordova 1.9 or greater
-* Android SDK updated with 15
+* Android SDK updated to the latest SDK
## Guide to using CordovaWebView in an Android Project
-1. Use `bin/create` to fetch the `commons-codec-1.6.jar` file.
+1. `cd` into `/framework` and run `ant jar` to build the cordova jar. It creates the .jar file formed as `cordova-x.x.x.jar` in the `/framework` directory.
-2. `cd` into `/framework` and run `ant jar` to build the cordova jar. It creates the .jar file formed as `cordova-x.x.x.jar` in the `/framework` directory.
+2. Copy the cordova jar into your Android project's `/libs` directory.
-3. Copy the cordova jar into your Android project's `/libs` directory.
-
-4. Edit your application's `main.xml` file (under `/res/xml`) to look like the following, with the `layout_height`, `layout_width` and `id` modified to suit your application:
+3. Edit your application's `main.xml` file (under `/res/xml`) to look like the following, with the `layout_height`, `layout_width` and `id` modified to suit your application:
<org.apache.cordova.CordovaWebView
android:id="@+id/tutorialView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
-5. Modify your activity so that it implements the `CordovaInterface`. You should implement the included methods. You may wish to copy them from `/framework/src/org/apache/cordova/DroidGap.java`, or implement them on your own. The code fragment below shows a basic application that uses the interface. Note how the referenced view id matches the `id` attribute specified in the XML fragment shown above:
+4. Modify your activity so that it implements the `CordovaInterface`. You should implement the included methods. You may wish to copy them from `/framework/src/org/apache/cordova/CordovaActivity.java`, or implement them on your own. The code fragment below shows a basic application that uses the interface. Note how the referenced view id matches the `id` attribute specified in the XML fragment shown above:
public class CordovaViewTestActivity extends Activity implements CordovaInterface {
CordovaWebView cwv;
@@ -67,58 +65,58 @@ but may be eventually be automated.
cwv.loadUrl(Config.getStartUrl());
}
- If you use the camera, you should also implement this:
-
- @Override
- public void setActivityResultCallback(CordovaPlugin plugin) {
- this.activityResultCallback = plugin;
- }
- /**
- * Launch an activity for which you would like a result when it finished. When this activity exits,
- * your onActivityResult() method is called.
- *
- * @param command The command object
- * @param intent The intent to start
- * @param requestCode The request code that is passed to callback to identify the activity
- */
- public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode) {
- this.activityResultCallback = command;
- this.activityResultKeepRunning = this.keepRunning;
-
- // If multitasking turned on, then disable it for activities that return results
- if (command != null) {
- this.keepRunning = false;
+If you use the camera, you should also implement this:
+
+ @Override
+ public void setActivityResultCallback(CordovaPlugin plugin) {
+ this.activityResultCallback = plugin;
}
+ /**
+ * Launch an activity for which you would like a result when it finished. When this activity exits,
+ * your onActivityResult() method is called.
+ *
+ * @param command The command object
+ * @param intent The intent to start
+ * @param requestCode The request code that is passed to callback to identify the activity
+ */
+ public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode) {
+ this.activityResultCallback = command;
+ this.activityResultKeepRunning = this.keepRunning;
+
+ // If multitasking turned on, then disable it for activities that return results
+ if (command != null) {
+ this.keepRunning = false;
+ }
- // Start activity
- super.startActivityForResult(intent, requestCode);
- }
+ // Start activity
+ super.startActivityForResult(intent, requestCode);
+ }
- @Override
- /**
- * Called when an activity you launched exits, giving you the requestCode you started it with,
- * the resultCode it returned, and any additional data from it.
- *
- * @param requestCode The request code originally supplied to startActivityForResult(),
- * allowing you to identify who this result came from.
- * @param resultCode The integer result code returned by the child activity through its setResult().
- * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
- */
- protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
- super.onActivityResult(requestCode, resultCode, intent);
- CordovaPlugin callback = this.activityResultCallback;
- if (callback != null) {
- callback.onActivityResult(requestCode, resultCode, intent);
+ @Override
+ /**
+ * Called when an activity you launched exits, giving you the requestCode you started it with,
+ * the resultCode it returned, and any additional data from it.
+ *
+ * @param requestCode The request code originally supplied to startActivityForResult(),
+ * allowing you to identify who this result came from.
+ * @param resultCode The integer result code returned by the child activity through its setResult().
+ * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
+ */
+ protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ super.onActivityResult(requestCode, resultCode, intent);
+ CordovaPlugin callback = this.activityResultCallback;
+ if (callback != null) {
+ callback.onActivityResult(requestCode, resultCode, intent);
+ }
}
- }
- Finally, remember to add the thread pool, otherwise the plugins have no threads to run on:
+Finally, remember to add the thread pool, otherwise the plugins have no threads to run on:
- @Override
- public ExecutorService getThreadPool() {
- return threadPool;
- }
+ @Override
+ public ExecutorService getThreadPool() {
+ return threadPool;
+ }
6. Copy your application's HTML and JavaScript files to your Android project's `/assets/www` directory.
-7. Copy `cordova.xml` and `plugins.xml` from `/framework/res/xml` to your project's `/res/xml` directory.
+7. Copy `config.xml` from `/framework/res/xml` to your project's `/res/xml` directory.