Changes to the way you add APIs to your app

To align with Apache Cordova, BlackBerry WebWorks 2.0 uses plugins, which contain an API or a set of APIs, to add features and functionality to your app. When you installed the BlackBerry WebWorks SDK, a number of plugins were installed with it, each providing access to a different feature of the platform.

In your existing BlackBerry WebWorks project, you handled access to the various APIs of the BlackBerry platform by adding <feature> tags to your config.xml file. At build time, the packager looked at the <feature> elements in the config.xml file to determine which BlackBerry WebWorks APIs to bundle with the app.

In BlackBerry WebWorks 2.0, however, you access an API by adding the appropriate plugin to your project. When you add a plugin, the WebWorks tools add the plugin to the /plugins folder. You can determine which plugins you need to add by looking at the <feature> elements in your old config.xml file; each <feature> element will map to a corresponding BlackBerry plugin.

Plugins can be added either from the BlackBerry 10 WebWorks SDK web tool, or from the command line.
  • To use the BlackBerry 10 WebWorks SDK web tool, click BlackBerry WebWorks <version> on the Start menu to open the tool, then click the Plugins button under your project's name in the navigation panel.
  • To use the command line, navigate to your project folder and then run:
    webworks plugin add <id> 
    where <id> specifies the unique identifier for the plugin.

A note about using HTML5 notifications

You should be aware that if you used HTML5 notifications in your previous app, you will need to add a plugin to access this functionality, even though it required no <feature> element previously. To access the same functionality, add the com.blackberry.notification plugin to your app.

Mapping BlackBerry WebWorks plugins to BlackBerry features

The following table outlines how BlackBerry WebWorks plugins map to the <feature> element entries in your existing config.xml file.

If you added this <feature> element: You'll need to add this plugin:
<feature id="" />
<feature id="blackberry.bbm.platform" /> com.blackberry.bbm.platform
<feature id="blackberry.connection" /> com.blackberry.connection
<feature id="blackberry.identity" /> com.blackberry.identity
<feature id="" /> com.blackberry.user.identity
<feature id="blackberry.invoke" /> com.blackberry.invoke
<feature id="blackberry.invoke.card" /> com.blackberry.invoke.card
<feature id="blackberry.invoked" /> com.blackberry.invoked
<feature id="" />
<feature id="" />
<feature id="blackberry.payment" /> com.blackberry.payment
<feature id="blackberry.pim.calendar" /> com.blackberry.pim.calendar
<feature id="blackberry.pim.contacts" /> com.blackberry.pim.contacts
<feature id="blackberry.push" /> com.blackberry.push
<feature id="blackberry.sensors" /> com.blackberry.sensors
<feature id="blackberry.system" /> com.blackberry.system
<feature id="blackberry.system.event" /> No longer supported. Event listeners must now be added to and removed from the document object. For backwards compatibility, events added to the sytem.event object are mapped to the document object, so no coding changes are required.
<feature id="blackberry.ui.contextmenu" /> com.blackberry.ui.contextmenu
<feature id="blackberry.ui.cover" /> com.blackberry.ui.cover
<feature id="blackberry.ui.dialog" /> com.blackberry.ui.dialog
<feature id="blackberry.ui.toast" /> com.blackberry.ui.toast

Last modified: 2014-03-10

comments powered by Disqus