Home

Awesome

Apache Cordova for BlackBerry 10


📌 Deprecation Notice

This repository is deprecated and no more work will be done on this by Apache Cordova. You can continue to use this and it should work as-is but any future issues will not be fixed by the Cordova community.

Feel free to fork this repository and improve your fork. Existing forks are listed in Network and Forks.


Apache Cordova is an application development platform that allows you to use common web technologies, primarily HTML5, JavaScript, and CSS, to create applications for mobile devices. Cordova uses a standard set of APIs to access common device features. Additional plugins allow you to access BlackBerry 10 specific APIs, so that you can extend your application to tightly integrate with the BlackBerry 10 OS.

Requirements

Cordova for BlackBerry 10 has the following software requirements:

Conventions

The instructions in this document will generally use / as the path separator. On Windows, you should enter \ where you see / in these instructions.

Setting up your signing keys

Before starting development, you'll need to register for your code signing key and debug token. The signing key allows you to sign your completed app so that you can distribute it through BlackBerry World. The debug token allows you to test an unsigned app on a BlackBerry 10 device. You do not need to create and install the debug token yourself; if you supply the keystore password, the build script will create and install the debug token for you.

Creating your project

To create a new project, you use the create command to set up the folder structure for your app.

  1. On the command line, navigate to the folder where you extracted Cordova.

  2. Run the create command using the following syntax:

    bin/create <path-to-project> [<project-package> [<project-name> [<path-to-www-template>]]]
    

This command creates the folder structure for your project at the specified location. All of your project resource files should be stored in the <path-to-project>/www folder, or in a subfolder within it.

where

Adding and managing targets

A target refers to a BlackBerry 10 device or simulator that you will use to test your app. Targets are added directly to your project; you can add multiple targets to your project, each with a unique name. Then, when you want to deploy your app to a particular target, you can simply refer to that target by name when you run your script.

###Add a target

To add a target, on the command line, type the following command:

    <path-to-project>/cordova/target add <name> <ip-address> [--type simulator] [--password <password>] [--pin <device-pin>]

where

###Remove a target

To remove a target, on the command line, type the following command:

    <path-to-project>/cordova/target remove <name>

Building your app

To build your app, run the build script. You can build the app in either release mode or in debug mode.

###Build your app in release mode

To build your app in release mode, on the command line, type the following command:

    <path-to-project>/cordova/build release [<target>] [--keystorepass <password>] [--buildId <number>] [--params <params-JSON-file>]

where

###Build your app in debug mode

To build your app in debug mode, on the command line, type the following command:

    <path-to-project>/cordova/build debug [<target>] [--params <params-JSON-file>] [--loglevel <error|warn|verbose>]

where

Note that all of these parameters are optional. If you have previously defined a default target (and installed a debug token, if that target is a BlackBerry device), you can run the script with no arguments, and the script will package your app and deploy it to the default target. For example:

    <path-to-project>/cordova/build debug

Deploying an app

You can test your app using either a BlackBerry device or an emulator. Before deploying your app, you must first create a target for the device or emulator you want to deploy your app to.

The run script will first build your app. If you intend to deploy an app to a physical device for testing, you must first install a debug token on that device. If you specify the --keystorepass <password> argument when running the run script, the script will create and install the debug token for you. You do not need a debug token to test your app on an emulator, even if that app is unsigned.

To deploy your app to a device or emulator, on a command line type the following command:

    <path-to-project>/cordova/run <target> [--no-build]

where

Adding and managing plugins

To add additional functionality that is outside of the core features of Cordova, you'll need to add plugins. A plugin represents a set of APIs that provide access to additional features of the platform.

In order to use a plugin, you must first add it into your project. Once added into your project, the plugin will be bundled with your project during the build process, to ensure that your app has access to all the APIs it needs.

To add and manage plugins you can use the plugman tool. It is available via npm (ie npm install -g plugman)

###Add a plugin

To add a plugin, on the command line, type the following command:

    plugman install --platform blackberry10 --project . --plugin <id|path|url> [--variable NAME=name]

###Remove a plugin

To remove a plugin, on the command line, type the following command:

    plugman uninstall --platform blackberry10 --project . --plugin <id>

###View a list of installed plugins

To view a list of installed plugins, on the command line, type the following command:

    plugman ls

Historical notes

If you are looking for BlackBerry Tablet OS or BBOS classic, you need to check them out via a branch:

BlackBerry Tablet OS:

    git checkout 2.9.0

BBOS 5 to 7:

    git checkout 2.8.0