[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16617190#comment-16617190 ] ASF GitHub Bot commented on CB-9393: janpio commented on a change in pull request #544: CB-9393: Documenting how to embed a SystemWebView URL: https://github.com/apache/cordova-docs/pull/544#discussion_r217978219 ## File path: www/docs/en/dev/guide/platforms/android/webview.md ## @@ -29,106 +29,86 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add CordovaLib in your settings.gradle file + +include ':app', ':CordovaLib' + +1. Add that project as a library project to your main project. This can be done in your application's build.gradle file found in +app/build.gradle: + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' + //Add Cordova below + debugCompile project(path: ":CordovaLib", configuration: "debug") + releaseCompile project(path: ":CordovaLib", configuration: "release") +} 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView Review comment: Commenting on old docs PRs is never the right solution. Better create a Stack Overflow question. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser >Priority: Major > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16617152#comment-16617152 ] ASF GitHub Bot commented on CB-9393: sandeep2244 commented on a change in pull request #544: CB-9393: Documenting how to embed a SystemWebView URL: https://github.com/apache/cordova-docs/pull/544#discussion_r217961511 ## File path: www/docs/en/dev/guide/platforms/android/webview.md ## @@ -29,106 +29,86 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add CordovaLib in your settings.gradle file + +include ':app', ':CordovaLib' + +1. Add that project as a library project to your main project. This can be done in your application's build.gradle file found in +app/build.gradle: + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' + //Add Cordova below + debugCompile project(path: ":CordovaLib", configuration: "debug") + releaseCompile project(path: ":CordovaLib", configuration: "release") +} 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView Review comment: what if i want to override > setWebChromeClient(WebChromeClient client) method of systemWebView I got rutime error of class cast exception This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser >Priority: Major > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15315295#comment-15315295 ] Windyrain commented on CB-9393: --- I am a Novice Hybird App developers, I wasted a lot of time when follow the guide on the official website step by step. I hope you can update Outdated documentation. Here is useful guide I found https://github.com/apache/cordova-docs/pull/544/files?short_path=602231b#diff-602231bcbd2487128f58ad4a4cb6d247 http://www.catharinegeek.com/embed-cordova-webview-in-android-native-app/ Thanks! > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15247734#comment-15247734 ] ASF GitHub Bot commented on CB-9393: Github user GustavoCostaW commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/544#discussion_r60228374 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,86 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add CordovaLib in your settings.gradle file + +include ':app', ':CordovaLib' + +1. Add that project as a library project to your main project. This can be done in your application's build.gradle file found in +app/build.gradle: + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' + //Add Cordova below + debugCompile project(path: ":CordovaLib", configuration: "debug") + releaseCompile project(path: ":CordovaLib", configuration: "release") +} 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView --- End diff -- initialize* > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15207483#comment-15207483 ] ASF GitHub Bot commented on CB-9393: Github user infil00p commented on the pull request: https://github.com/apache/cordova-docs/pull/544#issuecomment-200070628 Blargh! I need to hunt down the merge conflict before re-sending this pull request. I have no idea what changed on this file, though. > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15207484#comment-15207484 ] ASF GitHub Bot commented on CB-9393: Github user infil00p closed the pull request at: https://github.com/apache/cordova-docs/pull/544 > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15196451#comment-15196451 ] ASF GitHub Bot commented on CB-9393: Github user riknoll commented on the pull request: https://github.com/apache/cordova-docs/pull/544#issuecomment-197065012 Minor comments, but otherwise looks pretty good! > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15196449#comment-15196449 ] ASF GitHub Bot commented on CB-9393: Github user riknoll commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/544#discussion_r56257602 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,86 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its --- End diff -- The link is sort of hidden on cordova.apache.org. Might be easier to just give https://dist.apache.org/repos/dist/release/cordova/platforms/ > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15196447#comment-15196447 ] ASF GitHub Bot commented on CB-9393: Github user riknoll commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/544#discussion_r56257510 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,86 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add CordovaLib in your settings.gradle file + +include ':app', ':CordovaLib' + +1. Add that project as a library project to your main project. This can be done in your application's build.gradle file found in +app/build.gradle: + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' + //Add Cordova below + debugCompile project(path: ":CordovaLib", configuration: "debug") + releaseCompile project(path: ":CordovaLib", configuration: "release") +} 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView + +//Set up the webview +ConfigXmlParser parser = new ConfigXmlParser(); +parser.parse(this); + +SystemWebView webView = (SystemWebView) findViewById(R.id.tutorialView); +webInterface = new CordovaWebViewImpl(new SystemWebViewEngine(webView)); +webInterface.init(iface, parser.getPluginEntries(), parser.getPreferences()); + +webView.loadUrl(parser.getLaunchUrl()); + + +1. Copy the application's HTML and JavaScript files to the Android --- End diff -- You also need to copy cordova.js from `bin/templates/project/assets/www` to that folder > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15196444#comment-15196444 ] ASF GitHub Bot commented on CB-9393: Github user riknoll commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/544#discussion_r56257379 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,86 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add CordovaLib in your settings.gradle file + +include ':app', ':CordovaLib' + +1. Add that project as a library project to your main project. This can be done in your application's build.gradle file found in +app/build.gradle: + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' + //Add Cordova below + debugCompile project(path: ":CordovaLib", configuration: "debug") + releaseCompile project(path: ":CordovaLib", configuration: "release") +} 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView + +//Set up the webview +ConfigXmlParser parser = new ConfigXmlParser(); +parser.parse(this); + +SystemWebView webView = (SystemWebView) findViewById(R.id.tutorialView); +webInterface = new CordovaWebViewImpl(new SystemWebViewEngine(webView)); +webInterface.init(iface, parser.getPluginEntries(), parser.getPreferences()); + +webView.loadUrl(parser.getLaunchUrl()); + + +1. Copy the application's HTML and JavaScript files to the Android + project's `app/src/main/assets/www` directory. + +1. Copy the `config.xml` file from `/framework/res/xml` to the --- End diff -- I found config.xml to be in `bin/templates/project/res/xml` > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 >
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15196439#comment-15196439 ] ASF GitHub Bot commented on CB-9393: Github user riknoll commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/544#discussion_r56257158 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,86 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add CordovaLib in your settings.gradle file + +include ':app', ':CordovaLib' + +1. Add that project as a library project to your main project. This can be done in your application's build.gradle file found in +app/build.gradle: + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' + //Add Cordova below + debugCompile project(path: ":CordovaLib", configuration: "debug") + releaseCompile project(path: ":CordovaLib", configuration: "release") +} 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView + +//Set up the webview +ConfigXmlParser parser = new ConfigXmlParser(); +parser.parse(this); + +SystemWebView webView = (SystemWebView) findViewById(R.id.tutorialView); +webInterface = new CordovaWebViewImpl(new SystemWebViewEngine(webView)); --- End diff -- `webInterface `needs to be declared > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15196441#comment-15196441 ] ASF GitHub Bot commented on CB-9393: Github user riknoll commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/544#discussion_r56257204 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,86 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add CordovaLib in your settings.gradle file + +include ':app', ':CordovaLib' --- End diff -- This line needs to be indented > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15196285#comment-15196285 ] ASF GitHub Bot commented on CB-9393: Github user infil00p commented on the pull request: https://github.com/apache/cordova-docs/pull/544#issuecomment-197026078 @riknoll Bump, I've updated the branch > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15185810#comment-15185810 ] ASF GitHub Bot commented on CB-9393: GitHub user infil00p opened a pull request: https://github.com/apache/cordova-docs/pull/544 CB-9393: Documenting how to embed a SystemWebView Redo of the pull request to update the SystemWebView documentation. You can merge this pull request into a Git repository by running: $ git pull https://github.com/infil00p/cordova-docs webview_update Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-docs/pull/544.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #544 commit 8c89253caba86b6ddbfc203332ecf46ec67350d2 Author: Joe BowserDate: 2016-03-08T21:12:15Z CB-9393: Documenting how to embed a SystemWebView > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15185332#comment-15185332 ] ASF GitHub Bot commented on CB-9393: Github user infil00p closed the pull request at: https://github.com/apache/cordova-docs/pull/498 > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15185334#comment-15185334 ] ASF GitHub Bot commented on CB-9393: Github user infil00p commented on the pull request: https://github.com/apache/cordova-docs/pull/498#issuecomment-193884897 Redoing this pull request on a whole new branch, because this one-off is not going to work with all the changes @jcesarmobile is suggesting. > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15150574#comment-15150574 ] ASF GitHub Bot commented on CB-9393: Github user jcesarmobile commented on the pull request: https://github.com/apache/cordova-docs/pull/498#issuecomment-185230674 I think this should be added too: `@Override public void onDestroy() { if (this.webInterface!=null) { this.webInterface.handleDestroy(); } super.onDestroy(); }` If I don't add it, when I use navigator.app.exitApp(); I get an ugly message like this: "MainActivity has leaked IntentReceiver org.apache.cordova.engine.SystemWebViewEngine$2@e41c27f that was originally registered here. Are you missing a call to unregisterReceiver()?..." > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15144477#comment-15144477 ] ASF GitHub Bot commented on CB-9393: Github user jcesarmobile commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/498#discussion_r52730825 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,73 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add that project as a library project to your main project. 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView + +//Set up the webview +ConfigXmlParser parser = new ConfigXmlParser(); +parser.parse(this); + +SystemWebView webView = (SystemWebView) findViewById(R.id.WebViewComponent); +webInterface = new CordovaWebViewImpl(new SystemWebViewEngine(webView)); +webInterface.init(iface, parser.getPluginEntries(), parser.getPreferences()); + +loadUrl(parser.getLaunchUrl()); + + +1. Copy the application's HTML and JavaScript files to the Android + project's `app/src/main/assets/www` directory. + +1. Copy the `config.xml` file from `/framework/res/xml` to the --- End diff -- There is no config.xml on /framework/res/xml. I've found two, one on test/res/xml and another on /bin/templates/project/res/xml, I suppose the good one is the one on bin, right? > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15144470#comment-15144470 ] ASF GitHub Bot commented on CB-9393: Github user jcesarmobile commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/498#discussion_r52730740 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,73 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add that project as a library project to your main project. 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15144471#comment-15144471 ] ASF GitHub Bot commented on CB-9393: Github user jcesarmobile commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/498#discussion_r52730759 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,73 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add that project as a library project to your main project. 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView + +//Set up the webview +ConfigXmlParser parser = new ConfigXmlParser(); +parser.parse(this); + +SystemWebView webView = (SystemWebView) findViewById(R.id.WebViewComponent); --- End diff -- you used the tutorialView id, not WebViewComponent > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15144467#comment-15144467 ] ASF GitHub Bot commented on CB-9393: Github user jcesarmobile commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/498#discussion_r52730725 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,73 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its --- End diff -- It's hard to find where to download it. Maybe the link should point to dist page https://dist.apache.org/repos/dist/release/cordova/platforms/ or github releases page https://github.com/apache/cordova-android/releases > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15144472#comment-15144472 ] ASF GitHub Bot commented on CB-9393: Github user jcesarmobile commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/498#discussion_r52730771 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,73 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add that project as a library project to your main project. 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView + +//Set up the webview +ConfigXmlParser parser = new ConfigXmlParser(); +parser.parse(this); + +SystemWebView webView = (SystemWebView) findViewById(R.id.WebViewComponent); +webInterface = new CordovaWebViewImpl(new SystemWebViewEngine(webView)); --- End diff -- Youd didn't create the webInterface variable before. > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15144475#comment-15144475 ] ASF GitHub Bot commented on CB-9393: Github user jcesarmobile commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/498#discussion_r52730805 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,73 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add that project as a library project to your main project. 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView + +//Set up the webview +ConfigXmlParser parser = new ConfigXmlParser(); +parser.parse(this); + +SystemWebView webView = (SystemWebView) findViewById(R.id.WebViewComponent); +webInterface = new CordovaWebViewImpl(new SystemWebViewEngine(webView)); +webInterface.init(iface, parser.getPluginEntries(), parser.getPreferences()); + +loadUrl(parser.getLaunchUrl()); + + +1. Copy the application's HTML and JavaScript files to the Android --- End diff -- where do we get the cordova.js? There is one on /bin/templates/project/assets/ > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15144473#comment-15144473 ] ASF GitHub Bot commented on CB-9393: Github user jcesarmobile commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/498#discussion_r52730788 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,73 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add that project as a library project to your main project. 1. Add the following to the application's `/res/xml/main.xml` file, with the `layout_height`, `layout_width` and `id` modified to suit the application: - -1. Modify the activity so that it implements the `CordovaInterface`. - It should implement the included methods. You may wish to copy - them from `/framework/src/org/apache/cordova/CordovaActivity.java`, - or else implement them on your own. The following code fragment - shows a basic application that relies on 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; -/* Called when the activity is first created. */ -@Override -public void onCreate(Bundle savedInstanceState) { -super.onCreate(savedInstanceState); -setContentView(R.layout.main); -cwv = (CordovaWebView) findViewById(R.id.tutorialView); -Config.init(this); -cwv.loadUrl(Config.getStartUrl()); -} +1. Add the following code to setup your Activity so that you have an interface -1. If the application needs to use the camera, implement the - following: +private CordovaInterfaceImpl iface = new CordovaInterfaceImpl(this); + +1. Add the following to intialize the WebView + +//Set up the webview +ConfigXmlParser parser = new ConfigXmlParser(); +parser.parse(this); + +SystemWebView webView = (SystemWebView) findViewById(R.id.WebViewComponent); +webInterface = new CordovaWebViewImpl(new SystemWebViewEngine(webView)); +webInterface.init(iface, parser.getPluginEntries(), parser.getPreferences()); + +loadUrl(parser.getLaunchUrl()); --- End diff -- I think it should be webView.loadUrl(parser.getLaunchUrl()); > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands,
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15144469#comment-15144469 ] ASF GitHub Bot commented on CB-9393: Github user jcesarmobile commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/498#discussion_r52730738 --- Diff: www/docs/en/dev/guide/platforms/android/webview.md --- @@ -29,106 +29,73 @@ components can communicate with each other, see Application Plugins. If you're unfamiliar with Android, you should first familiarize yourself with the [Android Platform Guide](index.html) and have the latest Android SDK installed before you attempt the more unusual development option -of embedding a WebView. Starting with Cordova 1.9, the Android -platform relies on a `CordovaWebView` component, which builds on a -legacy `CordovaActivity` component that pre-dates the 1.9 release. +of embedding a WebView. Starting with Cordova 4.0, the Android +platform relies on a `SystemWebView` component. 1. To follow these instructions, make sure you have the latest Cordova distribution. Download it from [cordova.apache.org](http://cordova.apache.org) and unzip its Android package. -1. Navigate to the Android package's `/framework` directory and run - `ant jar`. It creates the Cordova `.jar` file, formed as - `/framework/cordova-x.x.x.jar`. +1. Create a project in Android Studio -1. Copy the `.jar` file into the Android project's `/libs` directory. +1. Copy the framework directory into your project's root directory and name it +CordovaLib + +1. Add that project as a library project to your main project. --- End diff -- maybe explain how to do it. I'm familiar with Android, but not so much with Android Studio and I didn't know how to do it. > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15143553#comment-15143553 ] ASF GitHub Bot commented on CB-9393: GitHub user infil00p opened a pull request: https://github.com/apache/cordova-docs/pull/498 CB-9393: Documenting how to embed a SystemWebView This is designed with Android Studio in mind. You can merge this pull request into a Git repository by running: $ git pull https://github.com/infil00p/cordova-docs master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-docs/pull/498.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #498 commit d9bf99a51dae980a30e55c1510548f6245c05332 Author: Joe BowserDate: 2016-02-11T21:35:56Z CB-9393: Documenting how to embed a SystemWebView in an Android Studio project > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15143687#comment-15143687 ] ASF GitHub Bot commented on CB-9393: Github user riknoll commented on the pull request: https://github.com/apache/cordova-docs/pull/498#issuecomment-183097926 Awesome! I'll give this a try when I get a moment. > Embedded use case is undocumented for Cordova-Android 4.0.x > --- > > Key: CB-9393 > URL: https://issues.apache.org/jira/browse/CB-9393 > Project: Apache Cordova > Issue Type: Bug > Components: Android >Affects Versions: 4.0.1 >Reporter: Joe Bowser >Assignee: Joe Bowser > Fix For: 5.0.0 > > > We broke the embedded webview use case for Android 4.0.x. and it's currently > difficult to embed a webview without some gradle editing. We should probably > work on getting the Embedded WebView use case to work out of the box for > Gradle, and in the meantime document all the workarounds for getting an > embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9393) Embedded use case is undocumented for Cordova-Android 4.0.x
[ https://issues.apache.org/jira/browse/CB-9393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14662561#comment-14662561 ] Joe Bowser commented on CB-9393: This is directly related to CB-8320 Embedded use case is undocumented for Cordova-Android 4.0.x --- Key: CB-9393 URL: https://issues.apache.org/jira/browse/CB-9393 Project: Apache Cordova Issue Type: Bug Components: Android Affects Versions: 4.0.1 Reporter: Joe Bowser Assignee: Joe Bowser Fix For: 5.0.0 We broke the embedded webview use case for Android 4.0.x. and it's currently difficult to embed a webview without some gradle editing. We should probably work on getting the Embedded WebView use case to work out of the box for Gradle, and in the meantime document all the workarounds for getting an embedded webview in Android Studio to actually work. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org