This section describes building the application for a Harmattan target and deploying the application on a Nokia N9. To enable the convenient deployment and debugging of the application on the Nokia N9, you need to install software on the phone to enable USB and WLAN connections with the Qt SDK. Some configuration is required in Qt Creator also.
To build and run Qt applications on the Nokia N9, you need the following:
- a Nokia N9 with USB cable.
- Qt SDK.
- a computer running*:
- 32- and 64-bit Linux;
- 32- and 64-bit Windows.
* Qt Creator uses the Maemo Application Development and Debugging Environment (MADDE) to build, deploy and debug your applications. Unfortunately this environment is not available for Apple Mac OS X.
Set up the Nokia N9 and Qt Creator
To develop for the Nokia N9, you must first enable the developer mode on the device: To do this open 'Settings' from the application menu and select 'Security' from the list of settings. Then navigate to 'Developer mode' view and enable the mode by flicking the switch in the menu item. Accept all possible requests. The phone will download and install all the necessary tools required for application development. Additional tools can be installed manually in 'Developer mode' view (see figure 23).
Figure 23: Developer mode view in settings.
Connecting the phone to PC
You can connect your Nokia N9 to your development PC using a USB or WLAN connection.
You need to use the SDK Connectivity tool, which was automatically installed when the developer mode was enabled, to create
the phone-side endpoint for a USB or WLAN connection.
Note: This section covers use of the USB connection. Please visit the MeeGo 1.2 Harmattan Developer Library for instructions on how to connect using WLAN.
Connect the phone to you PC with the USB cable and select 'SDK mode' from the dialogue shown by the phone. Launch the SDK Connectivity tool and tap the USB button in the application's main page. The application will then display the 'Connectivity Details' page, which contains the password required to establish the first connection with the Qt SDK (see figure 24). Note that a new password is generated every time the SDK Connectivity tool is used and valid only when the tool is running.
Leave the SDK Connectivity tool running and open the Linux phone settings (shown in figure 25) from Qt SDK (Tools -> Options -> Linux Devices tab).
Click Add, select Device with MADDE support in the displayed dialogue and click Start Wizard. Name the configuration (see figure 26) and click Next. In most cases there's no need to change the IP address, but for trouble shooting please refer to the MeeGo 1.2 Harmattan Developer Library.
Next you can set up key-based authentication of the connection between the phone and the Qt SDK. This is recommended as it frees you from needing to use password every time you connect your phone to the PC. To do this, you must first create a new key: Select No in the Device Status Check dialogue and click Next. In the Existing Keys Check dialogue, select the create new keys option. You will then be prompted for the location of the new key pair, and for a password to encrypt your private key (see figure 27).
Finally, proceed to the Key Deployment dialogue (see figure 28).
Once you have deployed the key using the password generated by the SDK Connectivity, you should see a dialogue notifying you of the successful deployment (see figure 29).
A phone configuration test is automatically run after the setup (see figure 30).
You have now successfully connected your Nokia N9 to Qt SDK. Next you will use the project template to create a new Qt Quick application for Nokia N9.
Build, deploy and run the application on the phone
The steps for creating a project are similar to the ones you followed in Step 2, except that we will use Qt Quick Components for Harmattan and select the Harmattan target for the deployment (see figures 31 and 32).
Figure 32: Selecting the Harmattan target.
With the project created, verify that the Harmattan build and run settings are set correctly. Click Projects to open the Projects view. You should see the build settings of the Harmattan target (see figure 33). The build configuration should be Harmattan Target (Qt SDK) Release and the Qt version Harmattan Target (Qt SDK).
The run settings (see figure 34) should have the configuration for your phone selected. In the Run Settings view you can manage the version number and the packaging information of your application.
Click Edit to get back to the editing view. Click the hammer button to build the application.
Now you are ready to deploy the application. Click Run to package the application and install it to the phone. The Debian package containing the built application can be located in the root folder of the project.
Now you have successfully deployed the application to your Nokia N9. Find out more about Qt application development by examining useful documentation, code, and learning resources