With the current Qt SDK (1.2.0 or newer) the scope of Nokia’s NFC developer offering took a significant step forward. It features the final environment for developing NFC apps on Symbian and Harmattan using Qt.
In order to enable you to take full advantage of the Qt / NFC development options, read this small guide that will make your first steps easier. For more information, please also check out the NFC technology pages at Nokia Developer!
Windows, Linux, Mac
You can develop NFC apps for the Nokia N9 with MeeGo Harmattan on all platforms supported by the Qt SDK: Windows, Linux and Mac OS X.
When you download and install the Qt SDK, ensure the following are selected:
- Development Tools -> Symbian Toolchains -> Symbian Anna
- Development Tools -> Harmattan
In case you forgot to enable for example the Harmattan package during installation, start the "SDK Maintenance Tool" to download and add these components to your existing Qt SDK installation.
Follow the instructions for all devices you want to enable for working with NFC:
- Nokia N9 / MeeGo Harmattan: The device already ships with Qt Mobility 1.2; no installation is needed. The Nokia N950 is running the same MeeGo Harmattan platform, but lacks NFC hardware.
- Nokia C7-00 with Symbian^3: NFC hardware comes with every C7 in the market, but you need Symbian Anna to enable NFC functionality. Therefore, make sure you run the "SW update" on the device, or use the Nokia (Ovi) Suite to start the firmware and the following application update! Your device should have software version Symbian Anna / 022.014 or newer (enter *#0000# in the dialer to check).
- Nokia C7-00 with Symbian Anna: the device is ready for NFC development using Java ME or Symbian native C++. In order to use Qt for NFC development, you need to update the device environment to the latest version, in case the new Qt versions are not already on your phone:
- Install Qt 4.7.4: C:\QtSDK\Symbian\sis\Symbian_Anna\Qt\4.7.4\Qt-4.7.403-for-Anna.sis
- Qt WebKit: C:\QtSDK\Symbian\sis\Symbian_Anna\Qt\4.7.4\QtWebKit-4.8.1-for-Anna.sis
- Qt Mobility 1.2.1: C:\QtSDK\Symbian\sis\Symbian_Anna\QtMobility\1.2.1\QtMobility-1.2.1-for-Anna.sis
- (Recommended) Qt Quick Components: C:\QtSDK\Symbian\sis\Symbian_Anna\QtQuickComponents\1.1\QtQuickComponents-1.1-for-Anna-Belle.sis
- Nokia 603 / 700 / 701 / C7-00 / 808 PureView with Nokia Belle or newer: if you’re lucky enough to have a NFC capable device with Nokia Belle +, you don’t need to do anything to enable Qt NFC development. Qt 4.7.4+ and Qt Mobility 1.2+ are already pre-installed and work out of the box. Do not overwrite the existing Qt / Qt Mobility installation with files from the Qt SDK that are intended for the Symbian Anna version only!
In addition, make sure you make your phone ready for communication with the Qt Creator IDE and on-device-debugging. This involves installing the "CODA" debug agent on all Symbian devices (no matter which version), or the "SDK Connectivity" tool on the Nokia N9. See the help of Qt Creator for more details.
In general, it is highly recommended to use Qt Quick Components for developing the UI of your NFC application. Qt Quick Components are supported on all NFC capable Symbian and MeeGo phones. More information, for example on NFC availability detection, is available on the NFC technology pages.
Nokia N9 / MeeGo Harmattan: simply select the MeeGo Harmattan target to build and deploy your application to the Nokia N9.
Symbian: select the "Qt 4.7.4 for Symbian Anna" target of Qt Creator to develop your application to any Symbian^3 / Anna / Belle phone.
Note: Qt SDK offers a Symbian Belle specific SDK. The apps developed with the Anna target are also compatible to Belle; you only need the Belle SDK in case you access native Symbian libraries (=> non-Qt) unique to Nokia Belle.
Examples to get started
The best way to get started is reading through the Nokia NFC Development with Qt Mobility presentation. It explains the basics of NFC specifications, how the Qt Mobility APIs provide easy access to the technology and then walks you through two hands-on examples.
The three recommended sample-projects to check — all of them are working on Symbian and on MeeGo Harmattan:
- Nfc Info: Shows all information about NFC tags available through Qt Mobility APIs. Includes reusable convenience classes for handling additional record types: Smart Poster, Image and vCard.
- Nfc Corkboard: Extends the Qt Quick Corkboards example of the Qt SDK with NFC functionality: touch a tag and its NDEF contents appear as a new note on the screen. Press the NFC flag of a note on the screen and its contents will be written to the tag. Parses URI, text, Smart Poster and vCard records and shows a generic post-it for all other tag types. Includes NDEF autostart support for MeeGo Harmattan PR 1.1+.
- Nfc Chat: The Nfc Chat is a sample app that demonstrates how to use the NFC LLCP protocol to create a peer-to-peer connection between two compatible NFC Forum devices and how to send messages between those devices.
More information can be found on the NFC technology pages.
Nokia Store Deployment
Deploying NFC apps to the Nokia store is fully supported on the Nokia Store. For more details on the deployment of NFC applications, make sure to check our NFC developer pages!
To save you some time, the known limitations at this time:
- No raw, tag-specific access on Symbian Anna: this doesn’t mean that the phone cannot interact with specific tags; reading and writing NDEF messages always works fine.
Each tag type platform (e.g., NFC Forum Type 1 Tag Platform) has its own low-level protocol, where you can send commands as byte-arrays, and then parse the byte-array returned from the tag. This raw access does work fine on Symbian Belle, but is unsupported using the current Qt Moblity 1.2.1 version on Symbian Anna.
- No raw, tag-specific access on MeeGo Harmattan: as described in the Qt Mobility documentation, tag-type specific access as described above is not supported on MeeGo Harmattan.
- Qt Simulator: the simulator has a very powerful editor to create your own NDEF messages and records. You can use it to test your Qt application.
Note that the two-step method of reading messages consisting of listening for targets and then asking the target for its contents does not work as expected. If you use the direct one-step process through QNearFieldManager::registerNdefMessageHandler(), the simulator works fine.
- NFC QML Bindings: even though Qt Mobility 1.2 includes QML bindings to make the Qt/C++ NFC-APIs available in the QML environment, it’s recommended to use only the Qt/C++ APIs. The documentation and features supported by the QML bindings are very limited. It’s easy to combine a C++ NFC-handler class with your QML user interface code — all three Qt NFC examples linked above (Nfc Info, etc.) demonstrate how to do this. You can then take the NFC-handling C++ class and simply plug it into any QML project you wish.
Update (22. November 2011): Adapted the article with the latest status following the release of the Qt SDK 1.1.4.
Update (6. March 2012): Added Nokia 808 PureView to compatibility, updated references to Qt SDK 1.2.