Deploying your app to a device
You can deploy your app to a device using the SDK web tool or the command line. The tool builds your app in debug mode, then installs and launches it on the device.
When you build the app in debug mode, the command packages your resources and plugins together in a .bar file, but does not sign it.
Debug mode also enables Web Inspector for the app, which allows you to remotely inspect the source code. A prompt displays the URL that you can use to connect to and inspect your app. For more information on using Web Inspector, see Debugging using Web Inspector.
- 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. To enable the Development mode on your device, navigate to Settings > Security and Privacy > Development Mode.
- 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 Signing and debugging: Frequently Asked Questions.
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 Signing and debugging: Frequently Asked Questions.
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.
Last modified: 2014-12-04