Deploy your app to a device
You can deploy your app to a device using the SDK web tool or the command line.
- Turn on Development Mode on the test target. Note that for security reasons, Development Mode expires after 10 days and whenever the device is rebooted. For more information, see Enable Development Mode on a device or simulator.
- Define your device as a test target, if you intend to test on a device over a Wi-Fi network (If you are testing on a device connected by USB, defining the device as a test target is unnecessary; the tools automatically detect it). For more information, see Set up your simulator or device as a target.
Deploy your project using the SDK web tool
To build your app in debug mode and deploy it to a device for testing:
- Open BlackBerry WebWorks <version>. A new browser window opens, displaying the BlackBerry 10 WebWorks SDK web tool.
- Navigate to your project and click Build.
- Select Debug Mode.
- From the Install Target drop down list,
select one of the following:
- To deploy to a device connected via USB, select Autodetect.
- To deploy to a device over Wi-Fi, select appropriate device target from the list.
- Enter your device password.
- Enter your keystore password, which you defined when you requested your BlackBerry ID token. If you have not yet requested your BlackBerry ID token, see set up your computer for testing and signing.
- Click Build & Install.
The tool packages your app into a .bar file, installs it on your device, and then opens it. If a .bar file with the same name exists on the device, the SDK first uninstalls the existing .bar file before deploying the new .bar file.
If a valid debug token is not already present on the device, the tool creates and installs the debug token for you before installing and opening the app. For more information about debug tokens, see A note about using debug tokens.
If you don't supply a device or keystore password, or supply an incorrect password, the SDK prompts you to enter the correct password before continuing the deployment process.
Deploy your project from the command line
You can build and deploy your app to a BlackBerry 10 device using the run command. The target device must be connected to your computer by USB connection or be connected to the same Wi-Fi network as your computer.
The run command first builds your app in debug mode and packages the app and its resources into a .bar file. It then deploys the .bar file onto the device, and automatically launches the app. If a .bar file with the same name already exists on the device, the run command first uninstalls the existing .bar file before deploying the new .bar file. If you choose, you can skip the build or launch steps of the process.
If you have not already created and installed a debug token, or your debug token has expired, specify the --keystorepass <keystore_pw> argument when running the run command. The command creates and installs the debug token for you as well. For more information about debug tokens, see A note about using debug tokens.
To build your app and launch it to a device:
- On the command line, navigate to your project folder.
- Run the following
webworks run [--devicepass <password>] [--target=<target_id>] [-k|--keystorepass <keystore_pw>] [--no-build] [--no-launch]
If successful, the run command launches the app on the device. It also places a copy of the unsigned .bar file in the following location: <your_app_project_directory>\platforms\blackberry10\build\device.
webworks run --keystorepass mypass
All parameters are optional. Check the table below for parameter details:
The device password. If you omit this parameter, you will be prompted to supply the device password, if necessary.
The target ID of a pre-defined target device.
If no target is provided and you have a BlackBerry 10 device that is connected to your computer via USB, the run command automatically detects it and launches the app on the connected device.
|-k | --keystorepass <keystore_pw>||
The keystore password, which you defined when you configured your computer to sign applications. This argument allows the run command to create and deploy a debug token to the device on your behalf to allow your unsigned application to run.
If you omit this parameter and you have not already created and installed a debug token on the device you are deploying your app on, you will be prompted to provide the keystore password.
Causes the command to skip the build step. The command deploys the most recently built version of the application. This is useful to test an application in release mode.
Causes the command to skip the launch step. The command deploys the app to the device, but does not actually launch the app.
A note about using debug tokens
Before you can deploy an unsigned app to the device, the device must have a valid debug token installed on it. The BlackBerry WebWorks SDK makes it simple to install a debug token on any target device; you only need to provide the keystore password when you deploy your app to a device. However, there are a few things you should know about working with debug tokens.
For the SDK to be able to create a debug token for you, you must first request your signing key and set up your computer for code signing. You can request your free code signing key by completing the form at https://www.blackberry.com/SignedKeys. For more information about setting up your computer for signing and setting the keystore password you use for creating your debug token, see Set up your computer for testing and signing.
Debug tokens are not specific to a single app; once you have a valid debug token installed on your BlackBerry 10 device, you can load any unsigned app onto the device for testing until the debug token expires.
Debug tokens are valid for 30 days. When a debug token expires, the BlackBerry 10 OS no longer allows unsigned apps that rely on that token to run. Note that you are limited to a total of 100 device PINs across all of active debug tokens associated with the same keystore password. This means that if you create and install debug tokens on 100 devices, you must wait for some of your debug tokens to expire before you create more.
Last modified: 2014-10-09