Read a URL from an NFC Tag

Moving on to the world of NFC tags, our sketches will get significantly shorter. As we’ve seen, tags come in different shapes and sizes. They mostly store a few dozen characters, which is why most tags contain a URL pointing to a website. For this first app, we’ll create a sketch that can read NFC tags.

Because we are dealing mostly with URLs, let’s also include some Processing code that lets us open the link in the device browser. We’ll check if it is a valid URL before we launch the browser. When we launch our sketch on the device, the app will wait for an NFC event to occur, which will be triggered when we touch the tag with the device. We’ll also want to display the tag’s content on the device, as shown here. ...

Get Rapid Android Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.