Developing NFC Applications
This article explains how to create NFC applications for the latest NFC equipped Symbian phones using Qt or Java technology. The article provides details on the UI considerations in NFC application design and the requirements for NFC applications to be distributed through Nokia Store. A pointer is provided to a project that enables NFC features for Symbian WRT widgets.
You can create applications that leverage NFC technology using APIs provided in Qt, Java™ ME, and Symbian C++. Of these options, using Qt is the recommended approach as it’s the core development framework for Symbian and is available for MeeGo powered phones as well.
Qt based development
You create NFC enabled applications using the Qt Mobility 1.2 Connectivity API. The advantage of this approach is that you are working with the productive Qt cross-platform API, so you can code once for an app that will run on Symbian and MeeGo phones.
- Qt Mobility 1.2 beta for Symbian add on for the Qt SDK 1.1: Installation instructions are provided in the package.
- API documentation.
You can find example apps and code in the Qt Mobility 1.2 beta for Symbian add on package. The package enables development with the Symbian C++ NFC API also.
Further example apps are the NFC Corkboard (demonstrates NDEF reading and writing) and NFC Chat (LLCP peer-to-peer communication). In addition, you can download a step-by-step walkthrough tutorial that explains how to code these apps plus the basic Qt concepts required for understanding the interaction.
Java ME based development
You can make use of the NFC features in Symbian phones using the Contactless Communication API (JSR-257) and Nokia Extensions to JSR-257. This may be the most convenient approach if you have developed NFC applications for Series 40 phones (such as the Nokia 6131 NFC and Nokia 6212 classic). To get started you will need an NFC enabled phone plus:
You can use the NFC phone SDKs for the Series 40 phones also, if you wish. In particular, these SDKs currently offer better features for testing.
Symbian C++ based development
If you’re familiar with Symbian C++ you can use the Symbian C++ APIs in a pure Symbian C++ app. To do this, you need an NFC enabled phone plus:
- SDK 1.0
- plug-in for the Nokia Symbian^3 SDK
- Bluetooth connection by touching two NFC enabled (C7) phones
Symbian WRT widgets
UI design considerations
As NFC is supported in a small (but set to grow) number of phones, it’s important to take this into account when creating your application.
In order to achieve a consistent and favourable user experience, applications should be aware of the presence of an NFC radio in the phone and check if the radio is turned on in the connectivity settings. This section provides a step-by-step guide to handling these requirements, along with relevant code snippets and references.
Check whether NFC supported
When an application starts it should check whether NFC is supported in the phones hardware and react appropriately. How the application should react depends on how the application uses NFC. Two design approaches are available:
NFC centric application
This is an application that works on NFC enabled phones only.
In this case the application should restrict its installation to NFC capable phones only and/or query whether the NFC functionality is available at runtime. Where NFC is available as a firmware upgrade (such as on the Nokia C7 phone through the Symbian Anna update), the application should ideally alert the user to upgrade the firmware with message "Please update your phone firmware to run this application" and then exit.
NFC enhanced application
This is an application that will works on phones without NFC phones and takes advantage of NFC only if available on a phone.
In this case the application should query whether NFC is supported in the phone’s hardware at install and runtime. If the phone is determines not to support NFC the features of the application that rely on NFC should be disabled and ideally hidden from the user. If the application detects that the phone would offer NFC after a firmware upgrade, the application may alert the user to upgrade the phone’s firmware, but continue running.
Check if the NFC radio is turned on or off
On Symbian phones the user has the option to manually turn the NFC radio on or off. This setting affects NFC enabled applications also. To provide a consistent and seamless user experience, applications using NFC should check the status of the NFC radio and alert the user to turn it on to use the application. A model user experience flow is demonstrated by the [ NFC share application]. In this application as the application starts it checks the status of the NFC radio and informs the user if the radio is off with the message "NFC is not active. Please activate NFC from Connectivity settings before using this application".
To determine if a phone offers NFC:
- In a Qt or Symbian C++ application use the IsFeatureSupported method of the TFeatureSet class and test for KFeatureIdNfc (ID = 117).
- In a Java application query the javax.microedition.contactless.version system property value for the supported JSR-257 version. If the API is supported on the phone, the property returns 1.0.
The following examples show how to implement the UX recommendations:
- NFC Launcher (Qt/Symbian) -This example uses a separate launcher application that checks the presence ofthe NFC feature on the phone and based on that launches the main application ordisplays a notification box alerting the user that NFC is not present.Translations of the notification strings are included.
- Mobile NFC app (Qt/Symbian)- This project is a Qt SDK NFC project template that automatically includes theNFC feature and NFC radio status checking logic. This is ideal for starting newapplication projects.
- NfcSettings application(Qt/Symbian) - This project uses the NFC feature and NFC radio logic from theMobile NFC app template andapplies it to a very simple application that shows the availability of NFC andradio status on the phone using a simple QML UI.
- NFCinteractor (Java ME) -This project demonstrates how to handle the NFC dependency in a Java Midlet. Itqueries the microedition.contactless.version system property value for thesupported JSR-257 version. If the API is supported on the phone, the propertyreturns 1.0.
If you choose to develop with the NFC phone SDKs for the Series 40 phones or make use of the Symbian^3 SDK with the NFC plug-in, these tools provide some emulation of NFC tags and devices suitable for application testing.
Features to emulate NFC tags and devices are planned for Qt SDK.
An NFC phone is recommended also to complete testing prior to distributing your application.
NFC enabled applications can be distributed as any other applications are, through Nokia Store. This article describes the requirements related to NFC feature handling and guidelines that must be implemented by the application to ensure a seamless user experience.
Requirements for the Nokia C7 phone with Symbian Anna
- The application must handle the cases where the user has not upgraded their Nokia C7 phone's firmware
- Only free applications are accepted
- Only applications using the Symbian API or created using Java ME are accepted (Qt Mobility 1.2 API support, in Smart Installer, will be added in the future)
- Optional: Check whether the NFC radio is turned on or off
Distribution to other Symbian NFC capable phones
- Applications can be created in any of the available languages using anyavailable API (Qt, native Symbian, or Java ME)
- Applications may be free or charged for
- Optional: Check whether the NFC radio is turned on or off
Obtaining an NFC enabled phone
As part of the Discounted Devices Program Nokia is making available an NFC Device Kit to Nokia Developer Launchpad and PRO members. The Kit includes an NFC mobile phone and sample NFC tags. You can purchase it from here: Discounted Devices Program.
If you’re not a member of Launchpad or PRO, you can find details on how to join Launchpad here.