Sunday, 17 February 2013

BB10: A little survival guide for the newbie developer

Introduction
This guide is made for BB10's developers in particular for Cascades developer with a BB10 device.
These are little advice that I found experimenting with BB10 in these last months.

Log it!
If you want to log something to the console, for better understand how your applications is working you can use qDebug() << "your string"; in c++


 or use console.log on QML


Now to be able to read your log you have to connect to your device with SSH!
To be able to do this, just right click on your usb connected device and select "Launch SSH Session" like in the following image.
After that you have a shell inside the device and you are able to send command directly from the device.
To watch the log produced by your application just type slog2info -w
and for the 2 previouse log:



SSH in device, good not only for logs!
After an ssh connection, you can type some command inside the device for example:
  • pwd: print your working directory
  • cd: to change your current directory
  • cat : print on the console the content of a file
  • ls: list the files and directory in your current directory
There are other commands, like in a unix enviroment, not all working but with just these 4 previous command you have a lot of power... and remember: With great power comes great responsibility.
For example? you can watch the content of a produced file from your app; start moving to /accounts/1000/appdata/ and than to your app directory:


Use "cat" on a file:


Renew your debug token, it is just 2 click!
Your debug token will expire.. To create a new one you can write command from your enviroment or use qde (a customized eclipse for bb10) like that:


Right Click on your usb device, than select Blackberry Tools and than Debug Token Details and you have this dialog.


Select your token and then Renew options and .. that's it!

Do you know any other useful tips?
Please write it in the comments!