You can create a PhoneGap plugin, which is a custom extension for the PhoneGap API. It contains some native code that performs some of its own functions, as well as a JavaScript interface that then exposes this functionality to you, the PhoneGap developer. By definition, a plugin is platform specific!
In your case, you will create a plug-in that provides the base data API to the PhoneGap browser instance. Presumably, since you already have a bunch of code based on basic data, most of the work is done. You just need to write a JavaScript wrapper around it and form your own code so that it fits into the plugin template.
A good place to start would be to tell Jesse about them; Please note that they are specifically designed for iPhone:
http://blogs.nitobi.com/jesse/2010/04/01/iphonegap-plugs/
Here are some examples of existing PhoneGap plugins, their use, and links inside the source code to see how they were built:
https://github.com/phonegap/phonegap-plugins
http://blogs.nitobi.com/shazron/2010/07/12/phonegap-iads-plugin/
http://blog.urbanairship.com/blog/2010/06/09/phonegap-push/
Here is one of the StackOverflower participants and the defendant above, Aaron :)
http://blog.clearlyinnovative.com/post/1097750723/phonegap-plugin-for-downloading-url
Hope this helps!
source share