Reputation: 33
PhoneGap has pre-defined event (deviceready, pause, resume, online, etc), and developer can add listener on it.
is it possible to define my own event and fire from the native thread, then the js callback can be invoked?
or is there any other way to asynchronously triger javascript functions?
Upvotes: 0
Views: 840
Reputation: 142
There is two ways for solve your question; If you want define your functions to your application, you can download the phonegap source file. You can define your functions with phonegap source. You can look these links; http://docs.phonegap.com/en/1.4.1/guide_getting-started_android_index.md.html http://www.youtube.com/watch?v=COoXbFegiWw or you can write plugin for your application.
I hope that helps...
Upvotes: 0
Reputation: 6010
You can create a link between native code and your JavaScript in the webview with plugins. Check out the docs: http://docs.phonegap.com/en/edge/guide_plugin-development_index.md.html#Plugin%20Development%20Guide
Upvotes: 3