Getting Started With Android Qt
← Qt Mobile Features | ● | Creating a new Android Qt Project →
Necessitas is the KDE community port of Qt for the Android platform. Here we are going to make a few first steps on the Android platform with Qt.
Let’s grab the Necessitas SDK and install it!
http://necessitas.kde.org/necessita/necessitas_sdk_installer.php
Here is a youtube video for getting started on Linux:
It is strongly suggested to use a Linux box as Necessitas is in beta status at the time of this writing!
Now, that we have installed the Necessitas SDK, what can we do with it? We open QtCreator and manage and develop our projects with it.
To do so, we should fire up QtCreator (on Linux start QtCreator/bin/necessitas from the cmd line) and make sure that QtCreator can see the Android Qt framework. Select the Build & Run section of the program options, then select the Qt Versions tab and check that it reads something like the following:
Necessitas 4.8.2n for Android armv5.
If that’s the case, we are ready to create a new Qt Mobile Android project: Click on the Project tab on the left and create a new project of the type “Mobile Qt Application”.
You will be asked to choose the ARM processor architecture. In the Necessitas SDK there is support for ARM v5 and ARM v7a. I am choosing ARM v5 for backwards compatibility.
Our deployment platform is a Samsung Galaxy Ace 2 with an ARM Cortex-A8 processor core implementing the ARM v7 instruction set architecture. Still, it is better to choose ARM v5, since the emulator does not appear to be working with ARM v7a yet.
Now that we have the toolchain installed and ready to be used, we want to make a test by deploying a Qt Mobile example app. There is a simple test case available from the Qt developer pages that displays the battery status with the Qt Mobile frame work on a Nokia phone (or the Maemo simulator for Symbian phones):
http://doc.qt.digia.com/qtcreator-2.1/creator-mobile-example.html
We am going to do the same, but deploy a slightly modified Qt Mobile example on our Android smartphone.
That is, we are not going to simply connect the battery status to a widget via
QSystemDeviceInfo *deviceInfo = new QSystemDeviceInfo(this);
connect(deviceInfo, SIGNAL(batteryLevelChanged(int)), widget, SLOT(setValue(int)));
but we are going to listen to geospatial positions updated from the GPS receiver as outlined at
http://qt-project.org/wiki/Retrieve_Location_Using_Qt_Mobility
← Qt Mobile Features | ● | Creating a new Android Qt Project →