For those who don’t know already, PhoneGap provides a way for developers of mobile web applications to convert their code into apps for different mobile platforms. Effectively this means “wrapping” the web app in some sort of native shell for iPhone, Android and so on.
Perhaps a little less well known is that PhoneGap uses the W3C Widgets specification as the “lingua franca” of mobile web applications. In particular, PhoneGap uses the W3C Widgets: Packaging and Configuration specification for both the widget metadata and to configure the APIs to use.
For the latter, PhoneGap uses the W3C Widgets
<feature> element for declaring which APIs the application wants available, e.g.:
Developers can also specify this information via a web form when uploading their widget, or include it in a config.xml file as per usual.
PhoneGap also adds a few extensions to the W3C specification, such as an <app:splash> element for defining a splash screen to display when the app launches on the phone, an orientation preference, a “versioncode” attribute (only used for Android), and a hover option for icons (only used for Blackberry).
Its interesting just how few extensions (and abuses, as Filip Maj has rather modestly described them) are actually needed in practice to target such a wide range of devices.
For more information on how PhoneGap implements W3C Widgets, check out the developer documentation for PhoneGap Build.