Since programming for BB10 is now supposedly much easier if you know Qt, I decided to give it a go and I have been reading this: https://developer.blackberry.com/cascades/docume
I also like vi
and make
. The really nice thing about BB10 development is that all the QNX command line tools and makefile templates are included in the Native Development Kit so it's easy to build and deploy apps from the command line.
To start developing from the command line you'll need to:
Set the NDK environment variables
Run bbndk-env.sh
found in your NDK install directory.
You should now have access to a load of binaries starting with blackberry-*. These will enable you to package and deploy your app onto the simulator or device.
Build for the arm architecture
To build binaries which will run on BB10 devices you'll need to build for the arm architecture:
qcc -Vgcc_ntoarmv7le main.c
To build for the simulator you'll need to build for the x86 architecture, assuming that's your host OS. You can view a list of all supported architectures by running qcc -V
Create the BAR descriptor XML
Every BB10 app must have a BAR descriptor file called bar-descriptor.xml
. This tells the target OS how to install the app. Here's a minimal sample (my app is called 'Mini'):
com.example.Mini
1
Mini
main
Package, sign and deploy
Assuming you've registered with RIM to sign applications you can package your app into a BAR (BlackBerry Archive) file and deploy this to the device using these commands:
#Package the app and set the author to match the debug token author
blackberry-nativepackager -package arm/mini.bar bar-descriptor.xml -devMode -debugToken ~/Library/Research\ In\ Motion/debugtoken1.bar
#Deploy the BAR to the to the device
blackberry-deploy -installApp 169.254.0.1 -password pass arm/mini.bar
Make things easier using Makefiles
You can use the Qt tools to make life easier for you:
qmake -project
to create a .pro file. Only run this once, subsequent runs will overwrite your .pro file.qmake
. This will generate a Makefile
based on your .pro filemake
to build your project.Further info
Check out the NDK samples here: https://github.com/blackberry/NDK-Samples and Community samples here: https://github.com/blackberry/Core-Native-Community-Samples. You can build, package and deploy all these samples to your device by running:
make CPULIST=arm EXCLUDE_VARIANTLIST=g deploy
You'll need to set your DEVICEIP
and DEVICEPW
environment variables to match your target.
Also check out the porting guide: http://developer.blackberry.com/native/documentation/porting_getting_started.html