The NDEF format is a standardized data format that allows devices to exchange information. It stands for “NFC Data Exchange Format” and is defined in the NFC Forum specification. The format is used to store and exchange data such as URLs, contact information, and other types of data.
NDEF is based on the ISO/IEC 7816-4 standard, which defines a generic data format for smart cards. The NDEF format builds on this standard to define a specific format for NFC tags and devices.
NDEF is an open format that can be used by any NFC-enabled device or tag. It is supported by all major operating systems and NFC chipsets.
What is an NDEF Message?
An NDEF message is a sequence of one or more NDEF records. An NDEF record contains three parts:
- A record type identifier (RTD)
- A payload
- An optional ID field
The RTD identifies the type of data stored in the record. The payload is the actual data, and the ID field is used to store an identifier for the record.
The NDEF format supports several different types of data, including text, URI, MIME Type, Smart Poster, URLs, and contact information. The format also supports custom data types.
NDEF messages can be stored on an NFC tag or device and read by any NFC-enabled device. NFC tags and devices can also be used to exchange NDEF messages between two devices.
Multiple NDEF Records
Can you have more than one NDEF record in one NDEF message? Yes, an NDEF message can contain multiple NDEF records. Each record has its type and payload.
In cases of multiple records, the first record is always the most important. It is the default record that will be processed by the NFC device.
The other records can be used to store additional data or to provide alternative representations of the data in the first record. For example, a URI record could be followed by a Text record with a human-readable version of the URI.
Most NFC apps will read and process the first NDEF record in an NDEF message and ignore the others. However, some apps may choose to read and process all of the records in an NDEF message.
If you must have multiple records, you should always put the most important record first. You should also understand the limitations of the NFC devices and apps that will be reading your NDEF message.
How to create an NDEF message?
An NDEF message is a sequence of one or more NDEF records. To create an NDEF message, you need to create each NDEF record and then add it to the message.
Creating an NDEF Record
Each NDEF record has three parts:
- A record type identifier (RTD)
- A payload
- An optional ID field
The RTD identifies the type of data stored in the record. The payload is the actual data, and the ID field is used to store an identifier for the record. Here is an example:
NdefRecord ndefRecord = new NdefRecord();
ndefRecord.setType(“url”);
ndefRecord.setPayload(“This is my website”);
NdefMessage message = new NdefMessage(new NdefRecord[] { ndefRecord });
message.putExtra(“format”, “NDEF”);
In this record, the type is “URL” and the payload is “This is my website”. The ID field is not set, so it will be empty. While this may appear complex, you don’t have to use any programming to create an NDEF message. You can use a tool to generate the message for you.
NFC Forum Standardized Tags Compatible with NDEF Format
The NFC Forum has standardized four types of tags that are compatible with the NDEF format:
- Type 1 Tag. This tag is based on the ISO/IEC 14443-3 standard and can be read and written by any NFC-enabled device. It has a memory size of 96 bytes and a speed of 106 kbps. However, it does not have a data collision protection mechanism. Innovision Topaz is one of the compatible products.
- Type 2 Tag. This tag is based on the ISO/IEC 14443-4 and has read/write capabilities. It has a memory size of 48 bytes/144 bytes and a speed of 106 kbps. It has an anti-collision mechanism and is compatible with NXP Mifare Ultralight, and NXP MIFARE Ultralight C.
- Type 3 Tag. This tag follows the ISO-18092 & JIS-X-6319-4 standard. It has a memory size of up to 9 KB and a speed of 212 kbps or 424 kbps. It is highly priced and compatible with Sony FeliCa.
- Type 4 Tag. This tag is compatible with the ISO/IEC 14443A/NXP DESFire standards. It has a memory size of up to 32 KB and a speed of 106 kbps, 212, or 424 kbps. It supports NDEF messages and is compatible with DESFire, MIFARE Classic, and MIFARE Ultralight.
When using these tags, you can be sure of interoperability and compatibility with the NDEF format. This means that you can use them with any NFC-enabled device or tag.
What are the Benefits of Using NDEF?
NDEF has several benefits over other data formats:
- NDEF is Interoperable
NDEF is a standardized data format that allows devices to exchange information. It is based on the ISO/IEC 7816-4 standard and is supported by all major operating systems and NFC chipsets.
This interoperability is critical for two reasons. First, it ensures that devices can exchange information regardless of the operating system or NFC chipset they are using. Second, it allows developers to create applications that can be used on any NFC-enabled device.
- NDEF is Flexible
The NDEF format is flexible and can be used to store a wide variety of data types. It supports text, URI, MIME Type, Smart Poster, and custom data types. This flexibility makes NDEF an ideal format for storing and exchanging information.
- NDEF is Open
The NDEF format is an open format that can be used by any NFC-enabled device or tag. It is not proprietary and does not require a license to use. You can write NDEF data on any NFC tag without worrying about compatibility issues.
- NDEF is Safe
The NDEF format supports encryption and signature features that allow you to securely store and exchange information. These features make NDEF an ideal format for storing sensitive information.