Sending or receiving content over NFC

In Cascades, you can use an NFC Share Card, or use the NFC Share API to send or receive content over NFC. Alternatively, you can use the C API library (libnfc and libnfc_bps) to send and receive content.

Some important items to consider when sharing various types of content:

NFC Forum tag reader and writer

A 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 NDEF message stored on the tag, and notifies the interested application for processing. To be able to read an NDEF message from an NFC tag, an app 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 app is launched according to the following logic:

Supported NFC tags

The BlackBerry 10 devices support the following NFC Forum compliant tags:

NFC Forum tag type Supported tags
Type 1
  • Topaz 96
  • Topaz 512
Type 2
  • MiFare Ultra Light
  • MiFare Ultra Light C
  • Infineon my-D Move
  • Infineon my-D NFC
  • Kovio 2K
  • NTAG203
Type 3
  • FeliCa RC-S888
  • FeliCa RC-S965
  • FeliCa Lite-S RC-S966
Type 4
  • MiFare DESFire EV1 (2k, 4k, 8k)
  • MicroPass 4101-2K
MiFare DESFire EV1 tags must be pre-formatted before they can be used with a BlackBerry 10 device.

ISO 15693 tag reader and writer

The 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(TAG_TYPE_ISO_15693_3). To write to an ISO 15693 tag, use nfc_tag_transceive().

Working with the mimeType, uri, and data properties

If you want to use Cascades to share an NDEF message, set the MIME-type of that content to application/vnd.rim.nfc.ndef. The mimeType, uri, and data properties are exposed in the following way:

Working with the NFC C API

If you want to use the NFC service C API (libnfc and libnfc_bps) to send or receive content, you must first connect to the NFC system and then register with the NFC service for the types of NFC events you are interested in. Failure to connect to the NFC system will result in the NFC_RESULT_SERVICE_CONNECTION_ERROR.

You can connect to the NFC system in one of the following two ways:
  • Connecting directly using nfc_connect(). You can read NFC events using nfc_read_event().
  • Registering with the BlackBerry Platform Services (BPS) using nfc_request_events(). The libnfc_bps library manages the NFC connection for your app and delivers NFC events to the app.
To register for NFC events, you call API functions defined in nfc.h. For example:
  • To read or write to an NFC tag, register for tag detection events using nfc_register_tag_readerwriter() and pass in the particular type of tag (defined in nfc_tag_type_t) your app is interested in as a parameter.
  • To be notified of LLCP connections from another NFC device, register this interest using nfc_register_snep_client().
  • To send a large file using Bluetooth or Wi-Fi connection handover, register to receive handover events using nfc_register_handover_listener(). Handover events are defined in nfc_event_type_t.