In this lesson, I will give you a more detailed introduction to NFC.

What is NFC?#


First thing first, what is NFC?

NFC stands for Near-Field Communication, and it's a wireless communication protocol.

A little about its history: it's rooted in RFID technology and was founded by Sony, Philips, and Nokia.

The standard organization for NFC is called NFC Forum, and almost all NFC specifications are defined by NFC Forum.

Being a wireless technology, NFC has a pretty short range, typically within 10 centimeters. It also has a relatively low bit rate, below 424 kbps.

Compare to other technologies#


Let's compare NFC to other well-known wireless technologies, such as Bluetooth and WiFi. As you can see, NFC has a much-limited range and much slower speed.

Typically when we perform wireless technology comparisons, we want them to have long-distance, high-speed capabilities. However, when we talk about NFC, these disadvantages actually become advantages.

Why so? Because of the short range, NFC provides more privacy and security. Attackers cannot hack you from great distances.

Because of the low bitrate, NFC is extremely effective for power consumption. As a mobile app developer, this basically means that NFC won't drain the mobile phone's battery.

This point also brings us to a unique feature regarding NFC...


The NFC tag doesn't need to carry a battery!

This is pretty mind-blowing. In our common sense, almost all consumer electronics require batteries or other power sources, like adapters plugged into a wall.

NFC technology achieves this by an asymmetric design. On the left-hand side of this diagram, an NFC reader creates a magnetic field. Magnetic fields can generate electricity, so the NFC tag on the right-hand side receives its power solely from the reader.

NFC terminologies#


Let's also introduce some NFC terminologies.

Device roles#

First is the device role. The NFC reader in our diagram is called an "initiator" because it starts the entire communication process. On the other hand, the NFC tag is called a "target."

Communication modes#

We also call the communication mode "passive" mode because the target can only respond to the initiator's command passively. It cannot actively send any data to the initiator. Target devices without batteries usually use passive mode.

Of course, we also have the so-called "active communication mode." In this mode, the target actively sends data to the initiator.

NFC operation modes#

Finally, the NFC operation mode.


An NFC device is in "reader mode" when it acts as an NFC reader. Besides reader mode, the NFC forum also defines other operation modes, which are: P2P mode, card emulation mode, as well as the latest wireless charging mode, which has not been widely adopted yet.

The NFC reader mode allows the NFC device to read or write passive NFC tags and stickers. Most of the NFC applications I mentioned earlier use this mode, such as transportation or ticketing systems. Even the key card to open a Tesla's car door operates in this mode.


The NFC "card emulation mode" allows the NFC device itself to act as an NFC card. The emulated NFC card can then be accessed by another NFC reader, such as a point-of-sale machine. The best example of this mode is Apple Pay. In this case, the iPhone becomes a contactless credit card, and we can then use it to buy goods in stores.


Finally is the NFC "P2P mode." This "peer to peer" mode allows the NFC device to exchange data with another NFC peer. One example of this mode is the Android Beam feature introduced by Google back in 2011. Besides that, this mode is not widely used in the real world.

Mobile platform support#


Let's take a look at the mobile platform support for NFC.

Let's check Android first.

The Android operating system has supported NFC since API level 10. It supported all three operation modes originally, but Google deprecated the NFC P2P-related API in API level 29.

iOS, on the other hand, has supported NFC from iOS 13 and iPhone 7, and it only supports reader mode. The card emulation mode is only available for their own proprietary apps, such as Apple Pay.

That's why in this course, we will focus on reader mode applications.

NDEF and NFC tag platforms#

Next, let's see this NFC specification diagram.


As you can see, this diagram groups related NFC specifications vertically by the operation modes.

It seems scary initially, but as React Native developers, we can focus on these two blocks.

They are NDEF and Type 2 ~ 5 Tag Specifications.


Let's talk about NDEF first. NDEF stands for NFC Data Exchange Format. It's defined by NFC Forum and aims to provide a tag-independent method of data exchange between NFC-enabled devices. It is often used to carry text-based data, such as URLs or contact info.

NDEF is supported by both iOS and Android. Since most of the NFC tags contain NDEF data, understanding it is very important for your NFC journey.

We have a dedicated module discussing NDEF. In the second app we'll build in this course, we will read and write NDEF into NFC tags and explain how to use NFC tags to trigger deep linking.

Another important block for us is the Type 2 ~ Type 5 Specifications. Some people refer to them as the "NFC Tag Platform."

Let's use the Type 2 Tag Platform as an example.


By the way, people in the NFC domain often use "T2T" instead of the full "Type 2 Tag Platform".

Again, NFC Forum defines what a Type 2 Tag should comply with. The specification covers topics like the memory structure and the basic command set (reads and writes) that we use to directly communicate with the NFC tag.

When you're designing an NFC application, using NDEF is sometimes not enough. You will need to directly manipulate the NFC tag's internal memory in order to use some advanced features available for certain NFC tags.

Let's see some real-world NFC tags and their features to address this point.


This table presents a feature summary for NXP NTAG families, which are the most used NFC tags all over the world.

Some features listed in this table, such as "AES" or "32bit password," must be configured using low-level tag platform commands rather than NDEF writing.

Being able to use these tag proprietary commands allows you to leverage the full power for your NFC tag hardware to create unique NFC applications.

We also have a dedicated module targeting Type 2 Tags. In the third app of this course, we will not only learn about the basic T2T commands but also the more advanced password protection feature.

What's next?#

I hope you're as excited as I am. In the next module, we will start our journey by creating our very first NFC app: Tag Counter Game. I'll see you there!

Start a new discussion. All notification go to the author.