Blog

March 15, 2019 / Technology

Read NFC tags with ease


Nowadays nearly every smartphone support NFC. Near-field communication is a set of protocols that enable two electronic devices, one of which is usually a smartphone, to establish communication by bringing them within 1.5” of each other. When you pay with Apple Pay or Android Pay by touching the reader with your phone it uses NFC to transfer the data. Some keycards are in fact passive NFC tags.

In iOS 11 Apple introduced CoreNFC framework which gives iOS devices an ability to read NFC tags. Here at Impekable we’ve built several apps with NFC support and we found the technology works very well. However, we also found CoreNFC lacks the ability to parse the tag payload. It provides low-level byte array and it’s up to the developer to convert it to a human-readable format.

It’s quite easy in the case of text, because the NFC standard, a text is just an array of characters (plus language code). It’s more complicated with URLs because the standard uses some tricks to pack URL prefixes in the limited space of tag memory. It’s even more complicated with so-called smart posters, which pack multiple payloads in one tag. It that case you have to get your hands dirty with tons of byte offsets, bit flags, endianness, and all that low-level stuff.

Wouldn’t it be great to have that human-readable data out of the box? Since we’ve used NFC several times we’ve developed and tested the code to handle NFC payload parsing. We use a lot of open source libraries in our apps and we feel an urge to give back to the community. So we’ve decided to open source our NFC decoder and it’s available for everyone at our GitHub page https://github.com/impekable/NFCDecoder.

Post a Comment

Name

E-mail Address

Website