BlackBerry Developer

Prepare for Cordova (iOS and Android) development on a Mac

Take Action Now so You Can Develop at the Developer Event

We'll dive right into hands-on development at the Developer Event with no time allocated for environment set-up. Perform the steps below prior to your event so you are all ready to go on the day of your event.

We encourage you to ask questions and share what you are learning with others! Just scroll down and post your questions, documents and videos in the discussion forum.

Step Action
1. Confirm Android Studio, XCode and SDK Installation

Before installing the Blackberry Dynamics Cordova Plugins you should have Android Studio, Xcode and the BlackBerry Dynamics SDK installed and confirm that you can build a native Blackberry Dynamics sample application.

Guides for are available here:

Prepare for iOS Development on Mac

Prepare for Android Development on Mac

2. Install Node.js

The first step to installing Cordova and the Blackberry Dynamics Plugins is to install the latest version of Node.js (LTS v6.11.4).

1) To install Node.js, download and run the installer, available here:

www.nodejs.org

2) Once the installation is complete, you can confirm the node installation by opening a terminal session and executing the following command:

node -v

3) The previous command should return v6.11.4 as of the posting of this document.

This completes the installation of Node.js

3. Install Apache Cordova

Once Node.js has been installed you can use Node Package Manager (NPM) to install Apache Cordova. 

1) Open the terminal application and use the following NPM command to install Cordova:

sudo npm install -g cordova@7.0.1

The above command is run using sudo and may request your password. The -g flag specifies that Cordova should be installed globally and the @7.0.1 qualifier directs NPM to install a specific version rather than the latest available. Our labs will be based on Cordova 7.0.1 which is the latest release supported by the BlackBerry Dynamics Plugins.

2) You can verify the installation of Cordova with the following command to check the installed Cordova version.

cordova -v

3) The previous command should return 7.0.1 as the installed Cordova version.

This completes the installation of Cordova.

4. Download and Install the BlackBerry Dynamics SDK for Cordova

Once Apache Cordova is installed, you can install the BlackBerry Dynamics Cordova Plugins.

The BlackBerry Dynamics Cordova Installation Guide can be found here: BlackBerry Dynamics SDK for Cordova - Development Guide

1) Download the Cordova Plugins here: BlackBerry Dynamics SDK for Cordova v3.3.0.119

2) Expand the plugins zip file. We also suggest you download and review the Release Notes document for complete instructions on installing and using the Cordova Plugins.

3) Once expanded, you will have a folder titled:

BlackBerry_Dynamics_SDK_for_Cordova_v3.3.0.119.zip

Copy or move this folder to a location you can easily refer to during development.

This completes the installation of the BlackBerry Dynamics SDK for Cordova.

5. Create and test your first BlackBerry Dynamics Android or iOS application for Cordova

Now that the plugins are installed and configured, here is how you create your first iOS and Android Applications

1) Create your Cordova project.

cordova create myapp com.mycompany.myapp

This above command create a new Cordova app with an application id of "com.mycompany.myapp" in a directory called "myapp".

2) Add required platforms to the Cordova project. 

cd myapp

The following commands will add both iOS and Android respectively:

cordova platform add ios

cordova platform add android

3) Add the configuration plugin to the project.

$ cordova plugin add <path to sdk plugins>/cordova-plugin-bbd-configure

4) Add the Blackberry Dynamics Plugins. You may add only those plugins required by your project, or add the "all" plugins which will through dependancies will add all of the plugins.

The "base" plugin is required by all others and must always be added either directly or through a dependancy.

To add all of the Blackberry Dynamics plugins to your project, use the following command:

cordova plugin add <path to sdk plugins>/cordova-plugin-bbd-all

5) Build the Cordova project:

cordova build

6) After these steps, you should have both iOS and Android directories inside of the platforms directory of your project. You may now open these using Xcode and/or Android studio to test your application.

Note: You may receive a Cordova build error attempting to build on iOS stating that “Code signing is required for product type ‘Application’ in SDK ‘iOS 11.0’”. If so, you can continue by completing the following steps:

  1. From the projects directory, run the following in Terminal.
    1. $ cordova prepare ios
  2. Open the project in Xcode.
  3. Configure application signing, and choose a Team as you would in any Xcode project.
  4. You may now build and deploy the application.
6. Get Ready You are now ready for Cordova development using BlackBerry Dynamics at the BlackBerry Developer Summit!