PhoneGap Releases New MultiView Plugin
We’re happy to announce the release of the new PhoneGap MultiView plugin with support for iOS and Android!
The MultiView plugin gives developers the ability to launch multiple Cordova Webviews within one PhoneGap application! Each webview is fully independent, is able to communicate with local storage, and has its own set of plugins.
The Demo Application
We have included a demo project in the PhoneGap repo so that you can see how the plugin works in action! The Demo features two views, a “parent-view” and a “child-view”, with the purpose of illustrating the passing of data between views. Please note that the plugin itself can support multiple views. Source code to our Demo Project is included in the PhoneGap repo, to run it in iOS/Android:
$ cd demo $ cordova platform add ios (or) cordova platform add Android $ cordova plugin add --link .. (Android does not link) $ cordova run ios (or) cordova run Android
Please check out a demo video which illustrates the passing of data between webviews:
MultiView Plugin Installation Instructions
After you have built your project, install the plugin in your project location:
$ phonegap plugin add phonegap-plugin-multiview (or) cordova plugin add phonegap-plugin-multiview
Quickstart Guide to Using the MultiView Plugin
The plugin and complete documentation are available for download here in the PhoneGap Repo.
$ PGMultiView.loadView(url, strPayload, success, error);
This is the first version of the API… More improvements are coming down the pipeline! We will be continually adding more functionality as we incorporate feedback!
Currently data is stored to memory (not disc). Under most operating conditions this should not be an issue. However, in an extreme low memory state you do risk losing data between views if either PGMultiView.java or or PGMultiViewActivity crash before reaching onStop() in the activity lifecycle.
This bug should be resolved in the near future, the next release of this plugin bindsEvents() and writes the saved view state to local storage so that it can be retrieved at OnPause() in the Cordova Activities’ lifecycle.
Your feedback is graciously accepted and appreciated! Please submit your pull requests and issues here.
Please feel free to reach out to me on twitter! –Sterling