- tag reading and writing
- peer-to-peer communication via Simple NDEF Exchange Protocol (SNEP)
- Logical Link Control Protocol (LLCP) connections
- Bluetooth connection handover
- virtual target emulation
- secure element (SE) transactions
- card emulation (for instance, payment transactions)
These capabilities allow BlackBerry 10 devices to support NFC use cases such as the following:
- reading and writing to NFC tags or smart posters
- NFC-based data exchange
- Bluetooth connection handover
- contactless payment (acting as a credit card)
- ticketing (for example, for events, transit system, etc.)
NFC Forum tag reader and writerA BlackBerry 10 device can read from or write to any tag that the NFC Forum supports. As a reader, the device detects the tag, reads the NFC Data Exchange Format (NDEF) message stored on the tag, and notifies the interested application for processing. To be able to read and act on a particular NDEF message from an NFC tag, an application must register its interest in that type of message.
An NDEF message may contain multiple records, and an NFC tag may contain two NDEF messages. In each case, an application is launched according to the following logic:
- One NDEF message with multiple records: NFC looks for an application registered for the first record type. If it is found, the application is notified and handles the message. If no application is registered to handle the first record, NFC continues on to the next record. For example, an NDEF message may contain two records: a proprietary Type Name Format (TNF) for the first record and a link to the BlackBerry World storefront for the second record to allow users to download the app.
- Two NDEF messages with one record each: NFC acts on both messages
simultaneously. An example use case is:
- The first NDEF message contains credentials for setting up a Bluetooth connection and is dispatched to an application to establish a connection with a Bluetooth headset.
- The second NDEF message is dispatched to a separate handler, which responds by launching an application to play music using the Bluetooth connection.
The NFC service APIs also allow an application to detect the proximity of a tag and write an NDEF message to it.
ISO 15693 tag reader and writerThe BlackBerry 10 device can also read and write to ISO 15693 tags.
To read an ISO 15693 tag, register for tag detection events by calling nfc_register_tag_readerwriter():
nfc_register_tag_readerwriter(TAG_TYPE_ISO_15693_3);To write to an ISO 15693 tag, use nfc_tag_transceive().
Peer-to-peer communicationWith peer-to-peer communication, a BlackBerry 10 device can exchange data with another NFC-enabled device using the Simple NDEF Exchange Protocol (SNEP), a client-server-based protocol defined by the NFC Forum.
A peer-to-peer application can also be built directly using the Logical Link Control Protocol (LLCP), a lower-level protocol over which SNEP runs. The NFC service provides a set of APIs for communication over LLCP. However, for its simplicity, we suggest using SNEP to build peer-to-peer communication applications.
Bluetooth connection handoverThe NFC service provides Bluetooth connection handover capability, which allows an application to connect with another Bluetooth device and tranfer files. The benefit of using Bluetooth connection handover is that connection setup does not require any further action from the user.
Due to its limited data rates and the requirement for physical proximity, NFC is typically used to transfer small amounts of data such as business cards or URLs. If your application needs to transfer large files (e.g., audio or video files), you should consider using NFC to initiate a Bluetooth connection handover, and use the Bluetooth connection to transfer files.
Virtual target emulationThe NFC service provides APIs for emulation of these types of virtual targets:
- A virtual NDEF tag. Using the tag emulation API, an application can emulate an NFC tag that stores an NDEF message, which is detected and read by another NFC-enabled device.
- A virtual ISO 14443-4 smart card. Using the ISO 14443-4 emulation API, an application can make the BlackBerry device appear like an ISO 14443-4 smart card, ready to connect and exchange APDUs with a reader device.
Card emulationThe card emulation capability is realized through the UICC Secure Element (SE).
The SE allows applets it hosts to run securely and perform card transactions with external card readers, essentially emulating a smart card.
Applications do not play a role in card transactions, but can communicate with the applet through card emulation APIs to obtain information related to card transactions. The card emulation APIs allow an application to:
- communicate with the applets on the SE through formatted byte arrays called Application Protocol Data Units (APDUs)
- register for and receive transaction notifications when transactions of interest take place on the SE