×
Namespaces

Variants
Actions
(Difference between revisions)

Developing NFC Applications

From Nokia Developer Wiki
Jump to: navigation, search
rebloor (Talk | contribs)
(Rebloor - Added new section on the requirements for distribution through Nokia Store)
rebloor (Talk | contribs)
(Rebloor - Updated the section on UI considerations with additional UX guidelines)
Line 1: Line 1:
 
[[Category:Draft]][[Category:Near Field Communication (NFC)]][[Category:Qt]][[Category:Java ME]][[Category:Symbian C++]]
 
[[Category:Draft]][[Category:Near Field Communication (NFC)]][[Category:Qt]][[Category:Java ME]][[Category:Symbian C++]]
 +
 
 
{{Abstract|This article explains how to create NFC applications for the latest NFC equipped Symbian phones using Qt or Java technology. The article provides details of the requirements for NFC applications to be distributed through Nokia Store.}}
 
{{Abstract|This article explains how to create NFC applications for the latest NFC equipped Symbian phones using Qt or Java technology. The article provides details of the requirements for NFC applications to be distributed through Nokia Store.}}
 
+
 
== Introduction ==
 
== Introduction ==
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 devices as well.  
+
 
+
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===
 
===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 devices.  
+
 
+
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.  
To get started you need [[#Obtaining an NFC enabled device|an NFC enabled device]] and the [http://www.developer.nokia.com/info/sw.nokia.com/id/da8df288-e615-443d-be5c-00c8a72435f8/Qt_SDK.html Qt SDK 1.1] plus:
+
 +
To get started you need [[#Obtaining an NFC enabled phone|an NFC enabled phone]] and the [http://www.developer.nokia.com/info/sw.nokia.com/id/da8df288-e615-443d-be5c-00c8a72435f8/Qt_SDK.html Qt SDK 1.1] plus:
 
* [https://projects.developer.nokia.com/QtM12bSymb Qt Mobility 1.2 beta for Symbian add on for the Qt SDK 1.1]: Installation instructions are provided in the package.
 
* [https://projects.developer.nokia.com/QtM12bSymb Qt Mobility 1.2 beta for Symbian add on for the Qt SDK 1.1]: Installation instructions are provided in the package.
* [http://doc.qt.nokia.com/qtmobility-1.2.0-beta1/connectivity-api.html Connectivity API documentation].
+
*[http://doc.qt.nokia.com/qtmobility-1.2.0-beta1/connectivity-api.htmlConnectivity 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.
 
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 [https://projects.developer.nokia.com/nfccorkboards NFC Corkboard] (demonstrates NDEF reading and writing) and [https://projects.developer.nokia.com/nfcchat NFC Chat] (LLCP peer-to-peer communication). In addition, you can download a [http://www.slideshare.net/andreasjakl/nokia-nfc-development step-by-step walkthrough tutorial] that explains how to code these apps plus the basic Qt concepts required for understanding the interaction.
 
Further example apps are the [https://projects.developer.nokia.com/nfccorkboards NFC Corkboard] (demonstrates NDEF reading and writing) and [https://projects.developer.nokia.com/nfcchat NFC Chat] (LLCP peer-to-peer communication). In addition, you can download a [http://www.slideshare.net/andreasjakl/nokia-nfc-development 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===
 
===Java ME based development===
You can make use of the NFC features in Symbian devices 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 devices (such as the Nokia 6131 NFC and Nokia 6212 classic). To get started you will need [[#Obtaining an NFC enabled device| an NFC enabled device]] plus:
+
* [http://netbeans.org/ NetBeans] or [http://www.eclipse.org Eclipse] IDE
+
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 [[#Obtaining an NFC enabled phone| an NFC enabled phone]] plus:
* [http://www.developer.nokia.com/info/sw.nokia.com/id/571baaf2-042a-4662-9d43-a5a68eb42d9d/Symbian_3_SDK_v1_0_en.zip.html Symbian^3 SDK 1.0]
+
*[http://netbeans.org/ NetBeans] or [http://www.eclipse.org Eclipse] IDE
* [http://www.developer.nokia.com/info/sw.nokia.com/id/fb8e0f5a-75db-4459-a82e-6eee9e569a90/NFC_Plug_in_Symbian_3_SDK.html NFC plug-in for the Nokia Symbian^3 SDK 1.0]
+
*[http://www.developer.nokia.com/info/sw.nokia.com/id/571baaf2-042a-4662-9d43-a5a68eb42d9d/Symbian_3_SDK_v1_0_en.zip.htmlSymbian^3 SDK 1.0]
* [http://library.forum.nokia.com/topic/Java_Developers_Library/GUID-9248DD7F-23BE-40A6-A8DC-823783443F10.html?resultof=%22%4e%46%43%22%20%22%6e%66%63%22%20 Developer's guide]
+
*[http://www.developer.nokia.com/info/sw.nokia.com/id/fb8e0f5a-75db-4459-a82e-6eee9e569a90/NFC_Plug_in_Symbian_3_SDK.htmlNFC plug-in for the Nokia Symbian^3 SDK 1.0]
You can use the [http://www.developer.nokia.com/Resources/Tools_and_downloads/Archive.xhtml NFC device SDKs for the Series 40 devices] also, if you wish. In particular, these SDKs currently offer better features for testing.
+
*[http://library.forum.nokia.com/topic/Java_Developers_Library/GUID-9248DD7F-23BE-40A6-A8DC-823783443F10.html?resultof=%22%4e%46%43%22%20%22%6e%66%63%22%20Developer's guide]
 
+
You can use the [http://www.developer.nokia.com/Resources/Tools_and_downloads/Archive.xhtml 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===
 
===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 [[#Obtaining an NFC enabled device|an NFC enabled device]] plus:
+
* [http://www.developer.nokia.com/info/sw.nokia.com/id/dbb8841d-832c-43a6-be13-f78119a2b4cb.html Carbide.c++]
+
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 [[#Obtaining an NFC enabled phone|an NFC enabled phone]] plus:
* [http://www.developer.nokia.com/info/sw.nokia.com/id/571baaf2-042a-4662-9d43-a5a68eb42d9d/Symbian_3_SDK_v1_0_en.zip.html Symbian^3 SDK 1.0]
+
*[http://www.developer.nokia.com/info/sw.nokia.com/id/dbb8841d-832c-43a6-be13-f78119a2b4cb.htmlCarbide.c++]
* [http://www.developer.nokia.com/info/sw.nokia.com/id/fb8e0f5a-75db-4459-a82e-6eee9e569a90/NFC_Plug_in_Symbian_3_SDK.html NFC plug-in for the Nokia Symbian^3 SDK]
+
*[http://www.developer.nokia.com/info/sw.nokia.com/id/571baaf2-042a-4662-9d43-a5a68eb42d9d/Symbian_3_SDK_v1_0_en.zip.htmlSymbian^3 SDK 1.0]
* [http://library.developer.nokia.com/topic/GUID-E35887BB-7E58-438C-AA27-97B2CDE7E069/GUID-76C9285D-5C89-4CBC-AB05-F14D6A95BC90.html#GUID-76C9285D-5C89-4CBC-AB05-F14D6A95BC90 API documentation]
+
*[http://www.developer.nokia.com/info/sw.nokia.com/id/fb8e0f5a-75db-4459-a82e-6eee9e569a90/NFC_Plug_in_Symbian_3_SDK.htmlNFC plug-in for the Nokia Symbian^3 SDK]
* [http://www.developer.nokia.com/Community/Wiki/Making_Bluetooth_connection_by_touching_two_NFC_enabled_(C7)_phones Making Bluetooth connection by touching two NFC enabled (C7) phones ]
+
*[http://library.developer.nokia.com/topic/GUID-E35887BB-7E58-438C-AA27-97B2CDE7E069/GUID-76C9285D-5C89-4CBC-AB05-F14D6A95BC90.html#GUID-76C9285D-5C89-4CBC-AB05-F14D6A95BC90API documentation]
 
+
*[http://www.developer.nokia.com/Community/Wiki/Making_Bluetooth_connection_by_touching_two_NFC_enabled_(C7)_phonesMaking Bluetooth connection by touching two NFC enabled (C7) phones ]
 +
 
== UI design considerations==
 
== UI design considerations==
As NFC is supported in a small (but set to grow) number of devices, it’s important to take this into account when creating your application.
+
There are two approaches you can take:
+
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.
* If your application offers functionality that relies entirely on NFC, you can restrict it to install on devices known to offer NFC hardware only.
+
* Where your application offers functionality that is useful without the use of NFC technology, then the UI should hide or disable the NFC features when running on a device without NFC hardware.
+
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.
However, in both cases when running on the Nokia C7-00 your application should test to see if NFC functionality is available. If it’s not available the application should request the user to perform a firmware update (either using the SW Update application on their device or by running software update in Ovi Suite).
+
 
+
===Check whether NFC supported===
To determine if a device offers NFC:
+
 
+
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".
 +
 +
===Implementation===
 +
 +
 +
====APIs available====
 +
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 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 device, the property returns 1.0.
+
* 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.
 
+
 +
 +
====Examples====
 +
The following examples show how to implement the UX recommendations:
 +
*[http://projects.developer.nokia.com/nfcnppexample 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.
 +
*[http://projects.developer.nokia.com/mobilenfcapp 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.
 +
*[http://projects.developer.nokia.com/NfcSettingsApplication NfcSettings application(Qt/Symbian)] - This project uses the NFC feature and NFC radio logic from the[http://projects.developer.nokia.com/mobilenfcapp Mobile 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.
 +
*[http://projects.developer.nokia.com/nfcinteractor 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.
 +
 +
 
== Testing==
 
== Testing==
 
+
If you choose to develop with the [http://www.developer.nokia.com/Resources/Tools_and_downloads/Archive.xhtml NFC device SDKs for the Series 40] devices or make use of the [http://www.developer.nokia.com/info/sw.nokia.com/id/571baaf2-042a-4662-9d43-a5a68eb42d9d/Symbian_3_SDK_v1_0_en.zip.html Symbian^3 SDK] with the [http://www.developer.nokia.com/info/sw.nokia.com/id/fb8e0f5a-75db-4459-a82e-6eee9e569a90/NFC_Plug_in_Symbian_3_SDK.html NFC plug-in], these tools provide some emulation of NFC tags and devices suitable for application testing.
+
If you choose to develop with the [http://www.developer.nokia.com/Resources/Tools_and_downloads/Archive.xhtml NFC phone SDKs for the Series 40] phones or make use of the [http://www.developer.nokia.com/info/sw.nokia.com/id/571baaf2-042a-4662-9d43-a5a68eb42d9d/Symbian_3_SDK_v1_0_en.zip.html Symbian^3 SDK] with the [http://www.developer.nokia.com/info/sw.nokia.com/id/fb8e0f5a-75db-4459-a82e-6eee9e569a90/NFC_Plug_in_Symbian_3_SDK.html 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.  
 
Features to emulate NFC tags and devices are planned for Qt SDK.  
 
+
[[#Obtaining an NFC enabled device|An NFC device]] is recommended also to complete testing prior to distributing your application.
+
[[#Obtaining an NFC enabled phone|An NFC phone]] is recommended also to complete testing prior to distributing your application.
 
+
 
   
 
   
 
==Application distribution==
 
==Application distribution==
 
+
 
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.
 
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===
 
===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
+
* The application must handle the cases where the user has not upgraded their Nokia C7 phone's firmware  
 
* Only free applications are accepted  
 
* 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)
 
* 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
 
* Optional: Check whether the NFC radio is turned on or off
 
+
 
===Distribution to other Symbian NFC capable phones===
 
===Distribution to other Symbian NFC capable phones===
 
+
 
+
* Applications can be created in any of the available languages using any available API (Qt, native Symbian, or Java ME)
+
*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
+
*Applications may be free or charged for
* Optional: Check whether the NFC radio is turned on or off
+
*Optional: Check whether the NFC radio is turned on or off
 
+
== Obtaining an NFC enabled device ==
+
== Obtaining an NFC enabled phone ==
 
+
If you’re a Nokia Developer Launchpad or PRO member you can obtain an NFC enabled device through the [https://forumnokia.secure.force.com/apex/Protodevice_Loaning_Service Prototype Device Loaning Service] or the [https://forumnokia.secure.force.com/apex/DDP Discounted Devices Program].
+
If you’re a Nokia Developer Launchpad or PRO member you can obtain an NFC enabled phone through the [https://forumnokia.secure.force.com/apex/Protodevice_Loaning_Service Prototype Device Loaning Service] or the [https://forumnokia.secure.force.com/apex/DDP Discounted Devices Program].
 
+
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 device and sample NFC tags. You can purchase it from here: [https://forumnokia.secure.force.com/apex/DDP Discounted Devices Program].
+
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: [https://forumnokia.secure.force.com/apex/DDP Discounted Devices Program].
 
+
 
If you’re not a member of Launchpad or PRO, you can find details on how to join Launchpad [http://www.developer.nokia.com/Developer_Programs/Launchpad.xhtml here].  
 
If you’re not a member of Launchpad or PRO, you can find details on how to join Launchpad [http://www.developer.nokia.com/Developer_Programs/Launchpad.xhtml here].  
 
 
 
 
 
   
 
   
 
+
 +
 +
 +
 
{{ArticleMetaData
 
{{ArticleMetaData
 
+
 
|sourcecode= [https://projects.developer.nokia.com/home/project/explore#action=results&c%5B%5D=336&f=&tab=active&page=1&numresults=10 Examples in Nokia Developer Projects]
 
|sourcecode= [https://projects.developer.nokia.com/home/project/explore#action=results&c%5B%5D=336&f=&tab=active&page=1&numresults=10 Examples in Nokia Developer Projects]
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
Line 90: Line 131:
 
|sdk= [https://www.developer.nokia.com/info/sw.nokia.com/id/da8df288-e615-443d-be5c-00c8a72435f8/Qt_SDK.html Qt SDK] or [https://www.developer.nokia.com/info/sw.nokia.com/id/4a94a6d5-c7f4-487f-b1d0-c9f269030dc1/Nokia_SDK_for_Java.html Nokia SDK for Java]
 
|sdk= [https://www.developer.nokia.com/info/sw.nokia.com/id/da8df288-e615-443d-be5c-00c8a72435f8/Qt_SDK.html Qt SDK] or [https://www.developer.nokia.com/info/sw.nokia.com/id/4a94a6d5-c7f4-487f-b1d0-c9f269030dc1/Nokia_SDK_for_Java.html Nokia SDK for Java]
 
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
|devicecompatability= [https://www.developer.nokia.com/Devices/Device_specifications/?filter1=symbian&filter2=nfc Symbian devices with NFC]
+
|devicecompatability= [https://www.developer.nokia.com/Devices/Device_specifications/?filter1=symbian&filter2=nfc Symbian phones with NFC]
 
|signing=<!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 
|signing=<!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 
|capabilities=<!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 
|capabilities=<!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->

Revision as of 02:29, 19 August 2011


This article explains how to create NFC applications for the latest NFC equipped Symbian phones using Qt or Java technology. The article provides details of the requirements for NFC applications to be distributed through Nokia Store.

Contents

Introduction

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.

To get started you need an NFC enabled phone and the Qt SDK 1.1 plus:

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:

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".

Implementation

APIs available

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.


Examples

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.


Testing

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.

Application distribution

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

If you’re a Nokia Developer Launchpad or PRO member you can obtain an NFC enabled phone through the Prototype Device Loaning Service or the Discounted Devices Program.

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.



Article Metadata
Code ExampleTested withCompatibilityArticle
Created: (16 Feb 2013)
Last edited: rebloor (19 Aug 2011)
236 page views in the last 30 days.
×