Porting Qt Applications to BlackBerry 10 Platform

Hi,

I played with BlackBerry 10 Alpha Device for quite sometime and as a result of it, i ported one of my Qt Symbian Application written in QML/JS to BlackBerry 10 platform.

BlackBerry 10 Qt

The purpose of writing this article is to provide an easy approach to port Qt Applications written in QML/JS to BlackBerry 10 platform and a walk-through to publish your contents to BlackBerry World :

Setting up a Development Environment

Please, read the following articles that talks about downloading BlackBerry Native SDK, setting up simulator, getting signing keys and testing on real device.

http://n4bb.com/absolute-beginners-guide-to-developing-a-blackberry-10-app-part-1/

http://n4bb.com/absolute-beginners-guide-to-developing-a-blackberry-10-app-part-2/

Note: If you are interested in using Qt Creator for BlackBerry 10 development, you can read the following article:

http://qt-project.org/wiki/Qt-Creator-with-BlackBerry-10

However, Qt Creator is not mandatory for porting your application.

Porting QML application to BlackBerry 10

Follow these steps to port your QML/JS code to BlackBerry 10 platform:

1- Create a new Cascades Project (New->BlackBerry Project->Cascades).

2- Copy qmlapplicationviewer.cpp and qmlapplicationviewer.h (from your Qt Project which you are going to port) to <BlackBerry NDK Workspace>\<Your Cascades Project>\src .

3- Replace your <BlackBerry NDK Workspace>\<Your Cascades Project>\main.cpp with this code :

#include<QtGui/QApplication>

#include “qmlapplicationviewer.h”

Q_DECL_EXPORT int main(int argc, char **argv)

{    QApplication app(argc, argv);

QmlApplicationViewer viewer;

viewer.setMainQmlFile(“app/native/assets/main.qml”);

viewer.showFullScreen();

return app.exec();

}

4-  Copy all QML files from your Qt Project i.e. <Qt Workspace>\<Your Project>\qml\<Your Project Name>\*.* to <BlackBerry NDK Workspace>\<Your Cascades Project>\assets .

5-  That’s it. Now, you are ready to build and run your project.

Tweaking your Qt Application

Your code will work fine on BlackBerry 10 but you have to work on graphics part as there is a difference in resolution of BB10 devices and MeeGo/Symbian devices:

BlackBerry 10 full touch devices: 720×1280

BlackBerry 10 keyboard devices: 720×720

BlackBerry 10 Dev Alpha devices: 768×1280

Please, read the following article for better understanding of device resolution:

https://developer.blackberry.com/cascades/documentation/ui/resolution/

BlackBerry 10 full touch icon size is 114×114 and for Playbook icon size is 86×86.

Please, read the following article for better understanding of icon size/type:

https://developer.blackberry.com/design/bb10/application_icons.html

Packaging and Distributing your BB10 application to BlackBerry World

Once you are ready to deploy your application, open bar-descriptor.xml which is located in your <BlackBerry NDK Workspace>\<Your Cascades Project>\ in QNX IDE.

bar-descriptor.xml in IDE

Set all the fields in bar-descriptor.xml i.e. Package Name, Package Version, Package Build ID, Author and Author ID (which can be set automatically by clicking “Set from Debug Token”).

To Package your application in .bar file, you have to build your project with “Device-Release” target first and then simply click “Export Release Build” from bar-descriptor.xml to create .bar file. The packaged .bar file will be found in < BlackBerry NDK Workspace>\<Your Cascades Project>\arm\o.le-v7\<Your App Name_version>.bar

To publish this .bar application file, you need to register at Vendor Portal for BlackBerry World:

https://appworld.blackberry.com/isvportal/login_input.do

Once you get registered, you are ready to put all the details of your app and submit it to BlackBerry World QA.

Hope it helps..

Best Regards,

Sajid Ali Anjum

About these ads

One Response to “Porting Qt Applications to BlackBerry 10 Platform”

  1. Sunil Singh Says:

    very nicely explained


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: