NDEF записи

NDEF

NDEF - это стандарт представления данных, разработанный NFC Forum. Он описывает как данные должны записываться в NFC метки и то как ими должны обмениваться NFC устройства. Большинство устройств с NFC модулем (считыватели, смартфоны, планшеты и т.д.) поддерживают чтение NDEF сообщений с NFC меток. Все типы NDEF сообщений могут быть записаны во все типы NFC чипов и NFC считывателей. Из-за ограничений размера памяти необходимо выбирать NFC чипы, исходя из типа тех данных, которые будут на него записаны. Каждая NDEF запись содержит две части:

  • Тип записи (record type)- указывает тип данных в записи
  • Данные записи (payload)

Эти две части описывают действие, которое необходимо совершить устройству при прикосновении к NFC метке. NDEF поддерживает достаточно ограниченный набор простых действий. Сложные действия могут быть реализованы с помощью специального ПО, установленного на NFC устройство. Преимущество использования формата NDEF заключается в том, что нет необходимости установки специального приложения на NFC устройстве (смартфоне, планшете). Note that since the action is occurring on the touching device without any custom code or without any server side integration, no analytic data is captured about the usage of the NFC tag. Multiple records can be written to an NFC tag; however many software applications only act on the 1st record.

Android Application Record

Overview

The Android Application Record (AAR) is a special type of NDEF record that is used by Google’s Android operating system to signify to an NFC phone that an explicitly defined Android Application should be used to handle an NFC tag; this is called the Tag Dispatch System. Often times an Android App record will be added as the 2nd NDEF record in the NDEF message. This is useful to developers when they want to ensure their application is the application that will handle the NFC tag.

Behavior

The Android Application record is a specific record type for Android. When an NFC enabled Android device reads an NFC tag with an Android Application record on it, the following logic occurs:

  • If the Android App defined in the AAR record is installed on the phone, then that application is opened and the NFC tag data is sent to that application via an Android Intent.
  • If the application is NOT installed on the phone, then the Google Play store app is opened to the application with the intention that the user should download the application.

Android’s NFC system is quite powerful and complex; view the Android NFC documentation for more information.

Contact Record

Overview

A Contact record is an NDEF record is used to share contact data using the vCard 2.1 data format. Note that a VCard record requires a greater amount of data storage compared to other record types. It is recommended that you use an NFC chip type with greater memory capacity or use the Tag Platform to store the contact data on the server rather than the NFC tag.

Behavior

The Contact record type is supported by most NFC enabled operating systems. Android will open up a new contact in the People app. After clicking through a dialogue, Windows Phone will allow you to save the contact locally.

Email Record

Overview

An Email record is an NDEF record used to prompt the creation of a new email on the device.

Behavior

The Email record type is supported by most NFC enabled operating systems. Note that the email is not automatically sent, but the user is prompted to send an email with the data from their own email account.

Geo Location Record

Overview

A Geo Location record is an NDEF record that is used to display a geographic point in a mapping application on the device. The geo location is defined in terms of latitude and longitude.

Behavior

The Geo Location record type is not yet well supported across NFC enabled operating systems.

Mime Type Record

Overview

A Mime Type record is an NDEF record that represents data that contextualized by a content-type. This record type is often used by mobile applications to store application-specific data.

Behavior

Common mime types (html, text…) are supported by NFC enabled operating systems. However while there is a standardized list of content types (images…), currently mobile device OSs do not handle them well.

Phone Number Record

Overview

A Phone Number record is an NDEF record that is used to trigger calling the specified phone number on the the device. Note the number is not immediately dialed, the user must press the “call” button to complete the call.

Plain Text Record

Overview

A Plain Text record is an NDEF record that is used to store plain text on an NFC tag. There are two primary use cases for this record type:

  • To display plain text on the device
  • To store a unique id on the NFC tag to be used by a custom application. Note a mime type record might be better suited for this use case.

Behavior

The plain text record type is supported by most NFC enabled operating systems, although the default behavior is not that exciting.

SMS/Text Record

Overview

An SMS/Text record is an NDEF record used to prompt the creation of a new SMS/Text message on the device. Note the message is not automatically sent; the user is prompted to send the text message from their device.

URI Record

Overview

A Uri Record is an NDEF record used to represent raw actions. A uri consists of a prefix and its contents. This record is only used by software developers for specific purposes. Technically most of the record types are Uri records (including Website records).

Behavior

URI records do not have a standard behavior; the prefix determines the behavior. In general only the common URI prefixes have default behaviors.

Website Record

Overview

A Website Record is an NDEF record used to open a url in a web browser on the device that is touching the NFC tag. Website records are the most common record type used. The urls of website records can contain unique parameters which the server can use to provide a dynamic response based on the parameter. The server’s response content type will determine what the browser will do; it could display a website, show an image, download a file, redirect to another website or any other standard HTTP response.

Behavior

The website record type is supported by all NFC enabled operating systems. It’s default behavior is to open the url in a browser. Many systems will open a new browser tab each time the NFC tag is touched which can result in many browser tabs open at once.