Editor’s note: below is a blog post from Bryan Higgins from the WebWorks team. @bryanhiggins on Twitter
As a member of the WebWorks team at BlackBerry, I’m proud to announce that all of our BB10 APIs have been released as Apache Cordova plugins. Developers using Adobe PhoneGap or other Apache Cordova distributions will now have access to the full set of APIs that we ship as part of the WebWorks SDK.
Cordova Plugin Registry
The plugins are available through the recently launched Cordova Plugin Registry. This central database of plugins is accessible via the command line interface for developers running version 3.1 or higher.
To install a plugin, simply use the “plugin add” command with the plugin’s id (see the chart below for a full list):
cordova plugin add com.blackberry.bbm.platform
This will fetch the plugin from the registry and install it into the app. It may also modify the config.xml file under platforms/blackberry10 to include permissions required for the plugin to function correctly.
The Plugins
All of the plugins we released are listed in the chart below. The API column links to the relevant WebWorks docs. The permissions column lists any app permissions automatically added when the plugin is installed.
Id | API | Permissions |
com.blackberry.app | Application | |
com.blackberry.bbm.platform | BBM Platform | bbm_connect |
com.blackberry.conection | Connection | |
com.blackberry.identity | Identity | read_device_identitying_information |
com.blackberry.invoke | Invoke | |
com.blackberry.invoke.card | Card | |
com.blackberry.invoked | Invoked | |
com.blackberry.io | I/O | |
com.blackberry.io.filetransfer | File Transfer | |
com.blackberry.notification | Notification | post_notification |
com.blackberry.payment | Payment | |
com.blackberry.pim.calendar | Calendar | access_pimdomain_calendars |
com.blackberry.pim.contacts | Contacts | access_pimdomain_contacts |
com.blackberry.push | Push | sys_use_consumer_pushrun_when_backgrounded |
com.blackberry.sensors | Sensors | |
com.blackberry.system | System | |
com.blackberry.ui.contextmenu | Context Menu | |
com.blackberry.ui.cover | Window Covers | |
com.blackberry.ui.dialog | Dialog | |
com.blackberry.ui.toast | Toast |
Moving From WebWorks to Apache Cordova
In the process of converting the WebWorks extensions to Apache Cordova plugins, two significant changes were introduced to make the APIs work well with the rest of the Apache Cordova ecosystem. If you’re a WebWorks developer moving to Apache Cordova, you’ll want to make note of these:
- There is no need to add feature elements to config.xml. The WebWorks SDK relied on feature elements to include APIs at package time. Apache Cordova applications install plugins using command line tools before they are built.
- Events are raised on document rather than blackberry.event. The core Apache plugins raise events on document. We have chosen to follow this convention. Use document.addEventListener rather than blackberry.event.addEventListener.
Follow Us On GitHub
The WebWorks team is committed to working in the open. All of our plugins are licensed under Apache 2 and full source code is available on our GitHub repository. Feedback and contributions are always welcome!