Samsung Electronics logo

NFC: Using Near Field Communication



The NFC API provides the Near Field Communication (NFC) service to enable information exchange between NFC-enabled devices (called "peers") or tags. The NFC-enabled devices can share contacts, photos, and videos, and can also act as smart cards. You can use an NFC-enabled device to communicate with NFC tags for a variety of activities, such as paying the grocery bill or downloading a coupon.

NFC provides the following advantages over short-range communication technologies, such as Bluetooth:

An NFC tag is a chip which can securely store personal information, such as debit card numbers or contact details. The methods of the NFCTag interface are used to access an NFC tag for reading or writing information. NFC tag types are identified using the type attribute of the NFCTagType type definition.

Note
Samsung Web API provides the following NFC tag types: GENERIC_TARGET, ISO14443_A, ISO14443_4A, ISO14443_3A, MIFARE_MINI, MIFARE_1K, MIFARE_4K, MIFARE_ULTRA, MIFARE_DESFIRE, ISO14443_B, ISO14443_4B, ISO14443_BPRIME, FELICA, JEWEL, ISO15693, and UNKNOWN_TARGET.

The NFC forum defines the NFC data exchange format (NDEF) for encapsulating the data exchanged between 2 NFC-enabled devices or an NFC-enabled device and an NFC tag. An NDEF message can store data in various formats, such as text, Multipurpose Internet Mail Extension (MIME) type object, or ultra-short RagTime Document (RTD). The NFC tags use NDEF for exchanging messages.

The main features of the NFC API include:

Note
If an application is on the background and uses the writeNDEF() or sendNDEF() method, an error callback is launched. These methods can only be used in the foreground.

You can launch NFC applications based on the NDEF message content using the application control functionalities. For example, if the application control with the http://samsungapps.com/appcontrol/operation/nfc/wellknown operation is defined in the config.xml file and an NFC-enabled device reads an NFC tag or receives an NDEF message whose first NDEF record has a record type (tnf value) set as NFC_RECORD_TNF_WELL_KNOWN, the NFC application is launched.

NFC applications can also be launched by the transaction of the card emulation functionality. NFC devices can communicate with point of sales (POS) terminals using the card emulation functionality to, for example, make a payment. If the application control with the http://samsungapps.com/appcontrol/operation/nfc/transaction operation is defined in the config.xml file and a transaction caused by the card emulation functionality occurs, the NFC application is launched.

The following table lists the NFC operations, scheme and mime.

Table: NFC operations
Operation Scheme MIME
http://samsungapps.com/appcontrol/operation/nfc/empty NULL NULL
http://samsungapps.com/appcontrol/operation/nfc/wellknown <scheme>:<host>/<path>

URL, for example:

  • http
  • http://samsungapps.com/
  • http://samsungapps.com/about/devices
  • http://samsungapps.com/about/*

URN, for example:

  • tel
  • mailto
  • mailto:webapp@samsung.com
U/<protocol_code>

For example: U/0x03, U/0x05, U/*

NULL <type_string>/*

For example: T/*, sp/*, */*

http://samsungapps.com/appcontrol/operation/nfc/mime NULL <type_string>/<subtype_string> (case-insensitive)

For example: text/x-vard, text/*, */*

http://samsungapps.com/appcontrol/operation/nfc/uri <uri>

For example: http://samsungapps.com/about/devices

NULL
http://samsungapps.com/appcontrol/operation/nfc/external <scheme>:<string> (case-insensitive)

For example: nfc:ext.samsungapps.com.ABC

NULL
http://samsungapps.com/appcontrol/operation/nfc/transaction nfc://secure/aid/<aid>

For example:

  • nfc://secure/aid/123456789
  • nfc://secure/aid/1234*
  • nfc://secure/aid/*
NULL

* The <protocol_code> and <scheme> must be in sync. See NFCForum-TS-RTD_URI_1.0 and NCF RTD (Record Type Definition) documentation on the NFC forum.