The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


NFC

NFC, courtesy of high-profile boosters like Google Wallet, is poised to be a significant new capability in Android devices. While at the time of this writing, only a handful of Android devices have NFC built in, other handsets are slated to be NFC-capable in the coming months. Google is hoping that developers will write NFC-aware applications to help further drive adoption of this technology by device manufacturers.

This, of course, raises the question: what is NFC? Besides being where the Green Bay Packers play, that is?

(For those of you from outside of the United States, that was an American football joke. We now return you to your regularly-scheduled chapter.)

Prerequisites

Understanding this chapter requires that you have read the core chapters, particularly the chapters on broadcast Intents and services.

What Is NFC?

NFC stands for Near-Field Communications. It is a wireless standard for data exchange, aimed at very short range transmissions — on the order of a couple of centimeters. NFC is in wide use today, for everything from credit cards to passports. Typically, the NFC data exchange is for simple data — contact information, URLs, and the like.

In particular, NFC tends to be widely used where one side of the communications channel is “passive”, or unpowered. The other side (the “initiator”) broadcasts a signal, which the passive side converts into power enough to send back its response. As such, NFC “tags” containing such passive targets can be made fairly small and can be embedded in a wide range of containers, from stickers to cards to hats.

The objective is “low friction” interaction — no pairing like with Bluetooth, no IP address shenanigans as with WiFi. The user just taps and goes.

… Compared to RFID?

NFC is often confused with or compared to RFID. It is simplest to think of RFID as being an umbrella term, under which NFC falls. Not every RFID technology is NFC, but many things that you hear of being “RFID” may actually be NFC-compliant devices or tags.

… Compared to QR Codes?

In many places, NFC will be used in ways you might consider using QR codes. For example, a restaurant could use either technology, or both, on a sign to lead patrons to the restaurant’s Yelp page, as a way of soliciting reviews. Somebody with a capable device could either tap the NFC tag on the sign to bring up Yelp or take a picture of the QR code and use that to bring up Yelp.

NFC’s primary advantage over QR codes is that it requires no user intervention beyond physically moving their device in close proximity to the tag. QR codes, on the other hand, require the user to launch a barcode scanning application, center the barcode in the viewfinder, and then get the results. The net effect is that NFC will be faster.

QR’s advantages include:

  1. No need for any special hardware to generate the code, as opposed to needing a tag and something to write information into the tag for NFC
  2. The ability to display QR codes in distant locations (e.g., via Web sites), whereas NFC requires physical proximity

To NDEF, Or Not to NDEF

The preview of this section took that left turn at Albuquerque.

NDEF Modalities

The preview of this section is [REDACTED].

NDEF Structure and Android’s Translation

The preview of this section will not appear here for a while, due to a time machine mishap.

The Reality of NDEF

The preview of this section is [REDACTED].

Sources of Tags

The preview of this section is in an invisible, microscopic font.

Writing to a Tag

The preview of this section took that left turn at Albuquerque.

Responding to a Tag

The preview of this section is sleeping in.

Expected Pattern: Bootstrap

The preview of this section was lost due to a rupture in the space-time continuum.

Mobile Devices are Mobile

The preview of this section was stepped on by Godzilla.

Enabled and Disabled

The preview of this section was lost due to a rupture in the space-time continuum.

Android Beam

The preview of this section was stepped on by Godzilla.

Beaming Files

The preview of this section is off trying to sweet-talk the Khaleesi into providing us with a dragon.

Another Sample: SecretAgentMan

The preview of this section was eaten by a grue.

Additional Resources

The preview of this section was whisked away by a shark-infested tornado.