NFC for you and me


  • Technical Inadvisory
  • Monday, 01 Jun 2020

NFC lets electronic devices communicate data between each other (or with compatible NFC tags), but only at really close distances of about ~5cm. — 123rf.com

Hello everyone, I have a most touching story to share with you today.

As in, I literally went around my house touching electronic doodads with my phone, in clear violation of current hygiene standards and common sense.

But seriously, this is exciting nerdy news! During an office hackday recently, I learned that the Chrome browser on Android introduced limited/experimental Web NFC support, which means I can now build web apps that let my digital code interact with the physical world, by tapping my phone on objects with NFC tags.

Alright, let me clarify: NFC (near-field communication) technology is a kind of tech that lets electronic devices communicate data between each other (or with compatible NFC tags), but only at really close distances (about ~5cm). NFC is related to RFID (radio-frequency identification, which is similar but can have a maximum range of a few metres) and shouldn’t be confused with Bluetooth (which connects two devices that have power) or NEC (which is the Nippon Electric Company and has nothing to do with this article).

NFC tags are programmable chips which can store a small amount of data (say, the title and ISBN of a library book), and come in a lot of different forms (say, a thin sticker that you can attach to a library book for digital cataloguing).





If you’re a gamer, the best example of NFC tech are Amiibos, which are those plastic Nintendo figurines that you can tap on your Nintendo Switch or 3DS to gain in-game bonuses. If you’re not a gamer, then a more boring yet practical example are the Google Pay and Apple Pay apps that let you pay by tapping your phone onto a contactless payment device.

Anyway, Web NFC is the new, still-being-explored system that gives websites and web apps access to your phone’s NFC functionality, and this has some very exciting potential!

Assuming, of course, that your phone is an Android device and you’re using Chrome version 81. And you give NFC permissions to that website or web app. And you enable the #experimental-web-platform-features and #enable-webnfc flags in your hidden advanced Chrome settings, and whisper the secret password when the stars align...

Wait, at this point you might be asking: doesn’t enabling Web NFC sound like a bit of a faff? And doesn’t my phone already use NFC technology already, because I just paid for my latte with my smartphone? And are you just getting excited over a piece of tech that’s been regularly used for ages by now?

Well, to answer your questions: yes, yes, and sorta.

Look, a lot of Android and iOS apps have had access to your phone’s NFC tech for a while now, but this is the first time that web apps and websites have the ability to do so. The difference is subtle yet important: Android and iOS apps (aka “native apps”) have to be installed on your phone, whereas web apps (aka “websites with fancy features”) just need a web browser and a URL.

You’d be surprised how much the installation process becomes a roadblock to people using the cool software that you make.





It’s the difference between saying, “hey, if you install Steam, and register for an account, then you can play Game X once you also download the setup file, and install the updates, and assuming the game is compatible with your operating system” versus saying, “hey, if you open bit.ly/2X6SeIl on any computer with a keyboard, you can immediately play Celeste”.

As a professional web developer, I’m pretty darn excited to have another feature in my toolset, and to see web apps advance closer to feature parity with native apps.

The last time I was this excited about web technology was when I learned that most browsers supported the Web Speech Synthesis API (which lets my apps perform text-to-speech on swear words in a variety of accents from around the British isles), and that some browsers supported the Web Speech Recognition API (which lets me torture my apps by forcing them to perform speech-to-text based on my Malaysian accent – no, dangit, I’m not trying to fly to koala loom-pour, melee-seer!)

If you’re a fellow web developer who’s interested in building your own NFC-enabled web app, check out the details on web.dev/nfc.

The applications for the technology is pretty broad: if you’re running a museum, pop a bunch of NFC tags on different exhibits that open an explainer video on the museum’s website/web app.

If you’re organising a treasure hunt for your friends and colleagues, build an app that unlocks hints when participants tap their phones on a physical clue.

Or simply stick an NFC tag onto every book, manga, video game, and DVD in your house and start running your own library catalogue. (Good luck with the Dewey Decimal System though!)

Side note: also check out mzl.la/2zKv8PB for more info on the Web Speech API if you’re interested in programming your own stuff.

As for me, I’m going to buy a bunch of cheap NFC tags and stick them to various things around my apartment. My NFC-enabled web app will then do nothing but say “beeb boop” in an elegant Scottish voice whenever I tap my phone on those items.

It’s not much, but since everyone here in the UK is still trying to stay 2m apart from each other thanks to the coronavirus, I’ll take any physical contact I can get.

(Raised by wild Nintendo consoles and trained in the ways of the computer scientist, Shaun A. Noordin tries to use his knowledge of web development, technology and video games for the greater good. Or for entertainment and amusement, whichever is easier. He has a lot of advice to share, but they’re all inadvisable to follow.)

Article type: free
User access status:

NFC

   

Did you find this article insightful?

Yes
No

100% readers found this article insightful

Across the site