简体   繁体   中英

Sencha Touch and PhoneGap

You built your app in Sencha Touch, loaded it in a web view wrapper in PhoneGAP. Now how would your Sencha Touch web app access data from PhoneGAP? since its in a web view?

Example you used PhoneGAP to get UDID, or device contact list etc, how are you suppose to send that to sencha? since its in a webview? Possible? If not what do you do?

An Intent? There is nothing more universal in Android than an Intent.

So Sencha Touch part issues an intent. Your PhoneGap HTML5 WebView catches this Intent. A WebView is still in an Activity. Its just a different type of activity I believe. So the activity webview can processed data/generate data based input or whatever and send out in the bundle of an Intent. Either side could also store in SQLite or SharedPreferences, and just use the intent to notify of the data change or request. Also consider startActivityForResult(intent) to get data back.

First for all Sencha Touch is just the framework you use to build your app. It doesn't control your application.

If you are using Phonegap as your Webview wrapper. By the way Sencha now also offer a "Native Wrapper".

You would call the various javascript api's which Phonegap will map to its native counterpart. Depending which api you called and if any data was returned you can handle this in a callback.

That's about it, there is need send anything to Sencha as you describe it. Its more a callback centered just like javascript.

The following links might help you.

http://www.sencha.com/learn/a-sencha-touch-mvc-application-with-phonegap/ http://robertdougan.com/posts/packaging-sencha-touch-2-with-phonegap-cordova

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM