NFC

The following information shows you how to use the invocation framework with NFC. If you are developing an app using C++ or QML, see NFC for information on using the NFC API.

Sharing a single local file or a URI

Here are the invocation attributes you use to invoke an NFC card to share a single local file or a URI:

Attribute Value
Target ID

sys.NFCViewer

Action

bb.action.SHARE

URI

Any valid URI value that is preceded by file:// (for example, file://, http://, or https://)

MIME type

Any valid MIME type value, such as audio/mp3, image/jpg, and application/myfiletype

Sharing a set of files or URIs

Here are the invocation attributes you use to invoke an NFC card to share a set of files or URIs:

Attribute Value
Target ID

sys.NFCViewer

Action

bb.action.SHARE

URI

list://

MIME type

Any valid MIME type value preceded by filelist/, such as filelist/audio/mp3, filelist/image/jpg, and filelist/application/myfiletype

Data

Data can be sent in JSON format as a list of metadata in the following format:

[{
    "uri":<file-uri>,
    "type":<mime-type>,
    "data":<metadata>
}] 

In the above code, the uri is the local path to the file, type is the MIME type for the specified file, and data is the associated metadata for the specified file (for example, thumbnail).

Sharing text

Here are the invocation attributes you use to invoke an NFC card to share text:

Attribute Value
Target ID

sys.NFCViewer

Action

bb.action.SHARE

MIME type

text/plain

Data

Text is sent as a byte array. UTF-8 encoding is supported.

Sharing NDEF messages

Here are the invocation attributes you use to invoke an NFC card to share NFC Data Exchange Format (NDEF) messages:

Attribute Value
Target ID

sys.NFCViewer

Action

bb.action.SHARE

MIME type

application/vnd.rim.nfc.ndef

Data

An NDEF message is sent in the form of a byte array. The nfc_get_ndef_message_bytes() function is used to create the byte array message.

Sharing URLs

Here are the invocation attributes you use to invoke an NFC card to share URLs, including remote files (for example, http://aa.mp3):

Attribute Value
Target ID

sys.NFCViewer

Action

bb.action.SHARE

MIME type

text/URI-list

Data

Data is sent as a URI to the remote file or link and must be URI encoded (for example, http://somesite/multi%20word%name.doc).

Sharing data as a URL

Here are the invocation attributes you use to invoke an NFC card to share your app's custom data or share an image or a document as a URL:

Attribute Value
Target ID

sys.NFCViewer

Action

bb.action.SHARE

MIME type

The MIME type can be specified in application/myapp, text/vCard format. Make sure that the values specified are different from the MIME type values used to share text, NDEF messages, and URLs.

Data

Custom data is sent in byte array form, specific to the app and MIME types mentioned above.

Last modified: 2014-11-17



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus