Windows Phone 8.1 Smart card Reader sample code

I have had quite a few queries from developers who watched the Building Apps for Windows Phone 9.1 Jump Start videos and are interested in the low-level smart card reading that I showed in module 15: Sensors and Proximity: NFC and Bluetooth in which I demoed an app that read data off a bank debit card. You can find all the samples we showed in the Jump Start at but the smartcard sample is missing from there.

There were two reasons for that: firstly, there have been no phones available that can run it! Until now that is. Low-level card reading needs a new NFC chipset that is only available in the newest phones that are only now coming to market, such as the Lumia 730 and Lumia 830. The device I used in the video was an engineering prototype. And the second reason for not publishing it was that at the time we published the code samples, I wasn’t sure we had the go-ahead from the card company whose card we used.

Anyway, now the phones are becoming available and the NFC Smart card team at Microsoft have published their ‘official’ sample up on MSDN code samples: NFC Smart Card Reader PC/SC Library . The Home page of the project explains it all perfectly, so I’ll just repeat a shortened version here:

“Example code and library for raw communication to NFC tags with Windows Phone 8.1, but requires a device with support (Lumia 830 & 73x)
NOTE: This code will work only on a Windows Phone running 8.1 or higher, and with an NFC driver that supports smart card reader mode such as the NXP PN547 which is available on the Lumia 730 and Lumia 830 (it will NOT work on a Lumia 930 or any existing hardware, even after updating to 8.1). See inside the MainPage.GetDevices() function for how to detect at runtime whether a device supports this functionality.

A new feature in Windows Phone 8.1 (on specific new hardware devices) is to be able to directly send raw commands to external plastic NFC cards, previously the phone could only read/write NDEF messages to NDEF-formatted tags but now you can talk to things like transit passes etc. For NXP PN547-based devices NFC cards such as MIFARE Classic/Ultralight/DESfire, ISO7816-4/APDU-based cards like JCOP, Jewel are supported as well as some limited support for ISO15693 and Felica. This project contains sample code only for MIFARE Classic/Ultralight/DESfire and Felica, but can be easily extended to support the others.”

So there you go! Go download this sample, get yourself one of the new phones, and start building interesting apps that interact with transit passes, security passes and take advantage of other smart card use scenarios!

2 thoughts on “Windows Phone 8.1 Smart card Reader sample code

Leave a Reply

Your email address will not be published. Required fields are marked *