The NFC Data Exchange Format (NDEF) is a standardized data format that can be used to exchange information between any compatible NFC device and another NFC device or tag. The data format consists of NDEF Messages and NDEF Records.
The NDEF format is used to store and exchange information like URIs, plain text, etc., using a commonly understood format. NFC tags like Mifare Classic cards can be configured as NDEF tags, and data written to them by one NFC device (NDEF Records) can be understood and accessed by any other NDEF compatible device. NDEF messages can also be used to exchange data between two active NFC devices in “peer-to-peer” mode. By adhering to the NDEF data exchange format during communication, devices that would otherwise have no meaningful knowledge of each other or common language are able to share data in an organized, mutually understandable manner.
NDEF is an NFC Forum data format. The data formats are implemented in
NdefRecord. This class provides methods to retrieve and modify the
NdefMessage on a tag.
There are currently four NFC Forum standardized tag types that can be formatted to contain NDEF data.
- NFC Forum Type 1 Tag (
NFC_FORUM_TYPE_1), such as the Innovision Topaz
- NFC Forum Type 2 Tag (
NFC_FORUM_TYPE_2), such as the NXP MIFARE Ultralight
- NFC Forum Type 3 Tag (
NFC_FORUM_TYPE_3), such as Sony Felica
- NFC Forum Type 4 Tag (
NFC_FORUM_TYPE_4), such as NXP MIFARE Desfire
It is mandatory for all Android devices with NFC to correctly enumerate
Ndef on NFC Forum Tag Types 1-4, and implement all NDEF operations as defined in this class.
Some vendors have their own well defined specifications for storing NDEF data on tags that do not fall into the above categories. Android devices with NFC should enumerate and implement
Ndef under these vendor specifications where possible, but it is not mandatory.
getType() returns a String describing this specification, for example
Android devices that support MIFARE Classic must also correctly implement
Ndef on MIFARE Classic tags formatted to NDEF.