Hands-on Tutorials for NFC Development

ajakl | 26 April, 2011 14:53

Recently at the WIMA conference in Monaco, Rovio revealed the new Angry Birds Magic together with Nokia. It unlocks additional levels when you touch the phones of friends, or if you find special promotional tags. This is done using Near Field Communication (NFC) technology.

How can you implement such exciting features yourself?

During the very same conference, Nokia hosted an NFC workshop where we were guiding through our new NFC developer offering. After an introduction by Sixten “Sigge” Sandstrom, Riikka Kivela explained the NFC architecture in Symbian devices. At the end of the event, Tuukka Ahoniemi from Digia quickly dissected their ShopWizer NFC app, followed by Jure Sustersic talking about business opportunities with NFC and Nokia.

During the main two hour tech session in the middle, I had the opportunity to first briefly introduce the large audience to Nokia’s NFC developer offering. After the environment setup with the latest Qt SDK 1.1 and Qt Mobility 1.2 Beta, you’re ready to code. At the moment, a Nokia C7 updated with a pre-release Symbian Anna is needed to test apps. This firmware version will be released soon, but is not publically available yet. Once you get the new version on your existing C7, the operating system's backend for Qt's NFC APIs are instantly available!

 

 Nfc Corkboards application running on the C7

 

After those preparations were done, we went right into coding the first NFC app. Instead of starting totally from scratch, we took the Corkboards example from the Qt SDK and extended it with NFC functionality. The original app has several dynamic notes pinned to different corkboards; you can easily switch between boards by swipe gestures.

After following the step-by-step instructions of the NFC workshop materials, a new note instantly appears when touching an NDEF formatted NFC tag – the contents of the message are shown on the screen (URI and Text NDEF records are parsed). If you then press the little NFC flag glued to each note, the note’s current contents are written back to the tag. You can download a slightly extended version of the solution from Forum Nokia Projects.

Thanks to the separation of the NFC handling engine in C++ and the UI written with Qt Quick, the engine itself can simply be plugged into every other project to augment it with NFC. After the workshop, I saw the NFC engine working in an existing Cover Flow-like image browsing app; this was done in a matter of minutes without any modifications to the engine itself.

 

Nfc Chat application running on the C7

The second example was the NFC Chat. Simply by touching two phones, you can send chat messages back and forth. On the tech side, this is all handled by NFC, where two devices communicate using LLCP. Touching is enough to establish the connection between the app running on both phones.

This time, we created a new app from scratch – which can be done in a matter of minutes when using the Qt Quick Designer. The NFC target discovery is then very similar to the previous example – only that we’re this time setting up sockets to communicate to another device, instead of reading messages from a tag. A server socket is then used to send messages to the other device; the client socket receives our UTF-8 formatted text messages.

The workshop materials are now all online for you to enjoy:

To find out more about developing NFC apps, also take a look at the new NFC Wiki page. More event coverage - including an interview with Mark Selby about Nokia's NFC plans - check out Nokia Conversations.


RSSComments

RE

Korting | 26/04/2011, 16:51

Thanks for the workshop slides :). Must have been a long presentation since the slideshow is 98 pages long ;).

Re: Hands-on Tutorials for NFC Development

ajakl | 26/04/2011, 20:46

ajakl

We didn't go through all of this in the workshop :)
E.g., the part about extending the NFC Corkboard example with tag writing was only for reference, and to continue experimenting after the workshop at home. The plan was to provide the best possible materials, so that everyone can learn as much as they want and continue reading and coding even after the official workshop.

You must login to post comments. Login
 
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2012 All rights reserved