© 2013 Samsung Electronics Co., Ltd. All rights reserved.
This API specifies a protocol for simple wireless interconnection of closely coupled devices operating at 13.56 MHz using Near Field Communication (NFC), which is an international standard (ISO/IEC 18092). To know more, see Technical Specifications.
There are three groups of application scenarios for NFC:
For more information on the NFC features, see NFC Guide.
Interface | Method |
---|---|
NFCManagerObject | |
NFCManager | NFCAdapter getDefaultAdapter() void setExclusiveMode(boolean mode) |
NFCAdapter | void setPowered(boolean state, SuccessCallback? successCallback, ErrorCallback? errorCallback) void setTagListener(NFCTagDetectCallback detectCallback, NFCTagType[]? tagFilter) void setPeerListener(NFCPeerDetectCallback detectCallback) void unsetTagListener() void unsetPeerListener() NDEFMessage? getCachedMessage() |
NFCTag | void readNDEF(NDEFMessageReadCallback readCallback, ErrorCallback? errorCallback) void writeNDEF(NDEFMessage ndefMessage, SuccessCallback? successCallback, ErrorCallback? errorCallback) void transceive(byte[] data, ByteArraySuccessCallback dataCallback, ErrorCallback? errorCallback) |
NFCPeer | void setReceiveNDEFListener(NDEFMessageReadCallback successCallback) void unsetReceiveNDEFListener() void sendNDEF(NDEFMessage ndefMessage, SuccessCallback? successCallback, ErrorCallback? errorCallback) |
NDEFMessage | byte[] toByte() |
NDEFRecord | |
NDEFRecordText | |
NDEFRecordURI | |
NDEFRecordMedia | |
NFCTagDetectCallback | void onattach(NFCTag nfcTag) void ondetach() |
NFCPeerDetectCallback | void onattach(NFCPeer nfcPeer) void ondetach() |
NDEFMessageReadCallback | void onsuccess(NDEFMessage ndefMessage) |
ByteArraySuccessCallback | void onsuccess(byte[] data) |
An enumerator that defines an encoding format for an NDEF record text.
enum NDEFRecordTextEncoding { "UTF8", "UTF16" };
An enumerator that defines the type of NFC tag.
enum NFCTagType { "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", "UNKNOWN_TARGET" };
The following values are supported:
This interface defines what is instantiated by the webapis object.
[NoInterfaceObject] interface NFCManagerObject { readonly attribute NFCManager nfc; };
WebAPIs implements NFCManagerObject;
There will be a webapis.nfc object that allows access to the functionality of the NFC API.
Accesses to the NFC tag/target.
[NoInterfaceObject] interface NFCManager { const short NFC_RECORD_TNF_EMPTY = 0; const short NFC_RECORD_TNF_WELL_KNOWN = 1; const short NFC_RECORD_TNF_MIME_MEDIA = 2; const short NFC_RECORD_TNF_URI = 3; const short NFC_RECORD_TNF_EXTERNAL_RTD = 4; const short NFC_RECORD_TNF_UNKNOWN = 5; const short NFC_RECORD_TNF_UNCHANGED = 6; NFCAdapter getDefaultAdapter() raises(WebAPIException); void setExclusiveMode(boolean mode) raises(WebAPIException); };
It provides access to the API functionalities through the webapis.nfc interface.
short NFC_RECORD_TNF_EMPTY
A constant to indicate empty format of NDEF record's type field.
short NFC_RECORD_TNF_WELL_KNOWN
A constant to indicate Record Type Definition (RTD) format of NDEF record's type field.
short NFC_RECORD_TNF_MIME_MEDIA
A constant to indicate MIME media types format in RFC 2046 [RFC 2046] of NDEF record's type field.
short NFC_RECORD_TNF_URI
A constant to indicate absolute URI, as defined in RFC 3986 [RFC 3986] format in RFC 2046 [RFC 2046] of NDEF record's type field.
short NFC_RECORD_TNF_EXTERNAL_RTD
A constant to indicate NFC forum external type [NFC RTD] format in RFC 2046 [RFC 2046] of NDEF record's type field.
short NFC_RECORD_TNF_UNKNOWN
A constant to indicate unknown type format in RFC 2046 [RFC 2046] of NDEF record's type field.
short NFC_RECORD_TNF_UNCHANGED
A constant to indicate whether the payload is an intermediate or final chunk of a chunked NDEF record.
getDefaultAdapter
Gets the default NFC adapter of the device.
NFCAdapter getDefaultAdapter();
with error type UnknownError in any other error case.
with error type SecurityError, if this functionality is not allowed.
try { var adapter = webapis.nfc.getDefaultAdapter() ; } catch (err) { console.log (err.name +": " + err.message); }
setExclusiveMode
Gives priority to the current application for NFC operations over other applications when it is in the foreground.
void setExclusiveMode(boolean mode);
If the current application gets priority and it is in the foreground, the system stops sending application controls that are usually sent to pick an application to handle the request when detecting NFC Tag or receiving NDEF Message from the connected NFC peer-to-peer target.
But when the current application goes to the background, it loses the priority.
with error type UnknownError in any other error case.
with error type SecurityError, if this functionality is not allowed.
try { webapis.nfc.setExclusiveMode(true) ; } catch (err) { console.log (err.name + ": " + err.message); }
This interface provides access to control the adapter by offering methods to control local NFC behaviors, such as turning on/off an adapter.
[NoInterfaceObject] interface NFCAdapter { readonly attribute boolean powered ; void setPowered(boolean state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void setTagListener(NFCTagDetectCallback detectCallback, optional NFCTagType[]? tagFilter) raises(WebAPIException); void setPeerListener(NFCPeerDetectCallback detectCallback) raises(WebAPIException); void unsetTagListener() raises(WebAPIException); void unsetPeerListener() raises(WebAPIException); NDEFMessage? getCachedMessage() raises(WebAPIException); };
readonly
boolean powered
The state of the NFC adapter.
setPowered
Sets the power of an NFC adapter to either a on state or a off state.
void setPowered(boolean state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
The ErrorCallback is launched with these error types:
with error type SecurityError, if this functionality is not allowed
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
var gNfcAdapter; var onPowerOn = function(){ // Called when NFC adapter is powered on try { console.log("Power on succeed"); // Implement NFC communication routines ... gNfcAdapter.setPowered( false, // Disable NFC adapter function () {console.log("Power off succeed"); }, // Handle success function () {console.log("Power off failed"); }); // Handle failure } catch (err) { console.log (err.name + ": " + err.message); } }; try { gNfcAdapter = webapis.nfc.getDefaultAdapter(); if (!gNfcAdapter.powered) { gNfcAdapter.setPowered( true, // Enable NFC adapter onPowerOn, // Handle succes function () {console.log("Power on failed")}); // Handle failure } else { onPowerOn(); } } catch (err) { console.log (err.name + ": " + err.message); }
setTagListener
Registers a callback function to invoke when an NFC tag is detected.
void setTagListener(NFCTagDetectCallback detectCallback, optional NFCTagType[]? tagFilter);
If the registration completes successfully, the detectCallback must be invoked when NFC tag is detected.
If no tagFilter is passed, it shall consider the default tagFilter. that is to set all tag types.
with error type UnknownError in any other error case.
with error type ServiceNotAvailableError, if the NFC service is not available.
with error type SecurityError, if this functionality is not allowed.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
var adapter = webapis.nfc.getDefaultAdapter(); var onSuccessCB = {onattach : function(nfcTag) { console.log("NFC Tag's type is " + nfcTag.type); }, ondetach : function() { console.log("NFC Tag is detached"); }}; adapter.setTagListener(onSuccessCB);
setPeerListener
Registers a callback function to be invoked when NFC peer-to-peer target is detected.
void setPeerListener(NFCPeerDetectCallback detectCallback);
If the registration completes successfully, the detectCallback must be invoked when NFC peer-to-peer target is detected.
with error type UnknownError in any other error case.
with error type ServiceNotAvailableError, if the NFC service is not available.
with error type SecurityError, if this functionality is not allowed.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
var adapter = webapis.nfc.getDefaultAdapter(); var onSuccessCB = {onattach : function(nfcPeer) { console.log("NFC Target is detected"); }, ondetach : function() { console.log("NFC Target is detached"); }}; adapter.setPeerListener(onSuccessCB);
unsetTagListener
Unregisters the listener for detecting an NFC tag.
void unsetTagListener();
with error type UnknownError in any other error case.
with error type ServiceNotAvailableError, if the NFC service is not available.
with error type SecurityError, if this functionality is not allowed.
var adapter = webapis.nfc.getDefaultAdapter(); // Receives NFCTag var onSuccessCB = {onattach : function(nfcTag) { console.log("NFC Tag's type is " + nfcTag.type); }, ondetach : function() { console.log("NFC Tag is detached"); }}; // Unregister the listener function unsetListen() { adapter.unsetTagListener(); } // Registers to be notified when NFC tag is detected. adapter.setTagListener(onSuccessCB)
unsetPeerListener
Unregisters the listener for detecting an NFC peer-to-peer target.
void unsetPeerListener();
with error type UnknownError in any other error case.
with error type ServiceNotAvailableError, if the NFC service is not available.
with error type SecurityError, if this functionality is not allowed.
var adapter = webapis.nfc.getDefaultAdapter(); // Receives an NFC peer. var onSuccessCB = {onattach : function(nfcPeer) { console.log("NFC Target is detected"); }, ondetach : function() { console.log("NFC Target is detached"); }}; // Unregisters the listener. function unsetListen() { adapter.unsetPeerListener(); } // Registers to be notified when NFC peer-to-peer target is detected. adapter.setPeerListener(onSuccessCB)
getCachedMessage
Gets the NDEF message cached when the tag is detected.
NDEFMessage? getCachedMessage();
If the operation completes successfully, the NDEF Message that was last read before launching your application should be returned.
with error type UnknownError in any other error case.
with error type SecurityError, if this functionality is not allowed.
// Gets the cached message var cachedMessage = webapis.nfc.getDefaultAdapter().getCachedMessage();
This interface provides accesses to the NFC tag.
[NoInterfaceObject] interface NFCTag { readonly attribute NFCTagType type; readonly attribute boolean isSupportedNDEF; readonly attribute long ndefSize; readonly attribute object properties; readonly attribute boolean isConnected; void readNDEF(NDEFMessageReadCallback readCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void writeNDEF(NDEFMessage ndefMessage, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void transceive(byte[] data, ByteArraySuccessCallback dataCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); };
readonly
NFCTagType type
The type of the NFC tag.
readonly
boolean isSupportedNDEF
An attribute to check if the NFC Tag supports NDEF format.
readonly
long ndefSize
The size of NDEF message stored in the tag.
readonly
object properties
The value is all tag information.
It is pairs of key and value. The array's index is the pair's key and value is its value.
var adapter = webapis.nfc.getDefaultAdapter(); var onSuccessCB = {onattach : function(nfcTag) { console.log("NFC Tag's type is " + nfcTag.type); for(var i in nfcTag.properties) { console.log("key:" + i + " value:" + nfcTag.properties[i]); } }, ondetach : function() { console.log("NFC Tag is detached"); }}; adapter.setTagListener(onSuccessCB);
readonly
boolean isConnected
The value is necessary to check if this tag is connected.
readNDEF
Reads the NDEF data from the NFC tag.
void readNDEF(NDEFMessageReadCallback readCallback, optional ErrorCallback? errorCallback);
The ErrorCallback is launched with these error types:
with error type NotSupportedError, if the feature is not supported by platform or current Tag doesn't support NDEF format.
with error type SecurityError, if this functionality is not allowed.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
writeNDEF
Writes the NDEF data to the NFC tag.
void writeNDEF(NDEFMessage ndefMessage, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
The ErrorCallback is launched with these error types:
with error type NotSupportedError, if the feature is not supported by platform or current Tag doesn't support NDEF format.
with error type SecurityError, if this functionality is not allowed.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
transceive
Access the raw format card. The transceive function is the only way to access the raw format card (not formatted). Each tag type requires its own command to access tags. This API provides low level access of tag operation. (Note that you must know each tag technology.)
void transceive(byte[] data, ByteArraySuccessCallback dataCallback, optional ErrorCallback? errorCallback);
The ErrorCallback is launched with these error types:
with error type NotSupportedError, if the feature is not supported by platform
with error type SecurityError, if this functionality is not allowed.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
An interface that provides access to the NFC peer-to-peer target.
[NoInterfaceObject] interface NFCPeer { readonly attribute boolean isConnected; void setReceiveNDEFListener(NDEFMessageReadCallback successCallback) raises(WebAPIException); void unsetReceiveNDEFListener() raises(WebAPIException); void sendNDEF(NDEFMessage ndefMessage, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); };
readonly
boolean isConnected
The value is necessary to check if this NFC peer-to-peer target is connected.
setReceiveNDEFListener
Registers a callback function to be invoked when an NDEF message is received from the connected NFC peer-to-peer target.
void setReceiveNDEFListener(NDEFMessageReadCallback successCallback);
with error type UnknownError in any other error case.
with error type ServiceNotAvailableError, if the NFC service is not available.
with error type NotSupportedError, if the feature is not supported by platform
with error type SecurityError, if this functionality is not allowed.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
var adapter = webapis.nfc.getDefaultAdapter(); // Receives NFCPeer var onSuccessCB = {onattach : function(nfcPeer) { console.log("NFC Target is detected"); nfcPeer.setReceiveNDEFListener( function(message){ console.log("Receive message"); }); }, ondetach : function() { console.log("NFC Target is detached"); }}; adapter.setPeerListener(onSuccessCB);
unsetReceiveNDEFListener
Unregisters the listener for receiving NDEF messages from the NFC peer-to-peer target connected.
void unsetReceiveNDEFListener();
with error type UnknownError in any other error case.
with error type ServiceNotAvailableError, if the NFC service is not available.
with error type SecurityError, if this functionality is not allowed.
with error type NotSupportedError, if the feature is not supported by platform
var adapter = webapis.nfc.getDefaultAdapter(); var onSuccessCB = {onattach : function(nfcPeer) { console.log("NFC Target is detected"); nfcPeer.setReceiveNDEFListener( function(message){ console.log("Receive message"); nfcPeer.unsetReceiveNDEFListener(); }); }, ondetach : function() { console.log("NFC Target is detached"); }}; } adapter.setPeerListener(onSuccessCB);
sendNDEF
Sends data to the NFC peer-to-peer target.
void sendNDEF(NDEFMessage ndefMessage, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
The ErrorCallback is launched with these error types:
with error type SecurityError, if this functionality is not allowed.
with error type NotSupportedError, if the feature is not supported by platform
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
The NDEFMessage interface.
[Constructor(), Constructor(NDEFRecord[] ndefRecords), Constructor(byte[] rawData)] interface NDEFMessage { readonly attribute long recordCount; attribute NDEFRecord[] records; byte[] toByte() raises(WebAPIException); };
readonly
long recordCount
The number of records in the NDEFMessage.
NDEFRecord[] records
The array of NDEFRecord objects in the NDEFMessage.
toByte
Gets the serial byte array of the NDEF message.
byte[] toByte();
If the operation completes successfully, it returns the serial byte array of the NDEF message.
with error type UnknownError in any other error case.
with error type TypeMismatchError, if the records whose type is not NDEFRecord are included in the NDEFMessage.
with error type SecurityError, if this functionality is not allowed.
with error type NotSupportedError, if the feature is not supported by platform
// Gets the cached message. var cachedMessage = webapis.nfc.getDefaultAdapter().getCachedMessage(); var raw = cachedMessage.toByte();
The NDEFRecord interface.
[Constructor(short tnf, byte[] type, byte[] payload, optional byte[]? id), Constructor(byte[] raw_data)] interface NDEFRecord { readonly attribute short tnf; readonly attribute byte[] type; readonly attribute byte[] id; readonly attribute byte[] payload; };
readonly
short tnf
The value of the record type (TNF value).
At least the following values must be supported:
readonly
byte[] type
The specified type in byte array.
The byte array contains 0 to 255 bytes.
readonly
byte[] id
The record ID.
The byte array contains 0 to 255 bytes.
By default, this attribute is set to an empty array.
readonly
byte[] payload
The record payload.
The byte array contains 0 to (2 ** 32 - 1) bytes.
// Creates a new NDEF record. var newRecord = new webapis.NDEFRecordURI("http://www.samsungmobile.com/"); var payload = newRecord.payload;
The NDEFRecord that has the text type payload.
[Constructor(DOMString text, DOMString languageCode, optional DOMString? encoding)] interface NDEFRecordText : NDEFRecord { readonly attribute DOMString text; readonly attribute DOMString languageCode; readonly attribute NDEFRecordTextEncoding encoding; };
readonly
DOMString text
The encoded text.
readonly
DOMString languageCode
The language code string value, followed by IANA[RFC 3066] (for example, en-US, ko-KR).
readonly
NDEFRecordTextEncoding encoding
The encoding type. By default, this attribute is set to UTF8.
The NDEFRecord that has URI type payload.
[Constructor(DOMString uri)] interface NDEFRecordURI : NDEFRecord { readonly attribute DOMString uri; };
readonly
DOMString uri
The URI string that is stored in the payload.
The NDEFRecord that has mime type payload.
[Constructor(DOMString mimeType, byte[] data)] interface NDEFRecordMedia : NDEFRecord { readonly attribute DOMString mimeType; };
readonly
DOMString mimeType
The mime type [RFC 2046] (for example, text/plain, image/jpeg ).
The success callback to be invoked when an NFC tag is detected or lost.
[Callback, NoInterfaceObject] interface NFCTagDetectCallback { void onattach(NFCTag nfcTag); void ondetach(); };
This callback interface specifies two methods:
It is used in NFCAdapter.setTagListener().
onattach
The method invoked when a tag is attached.
void onattach(NFCTag nfcTag);
ondetach
The method invoked when the connected tag is detached.
void ondetach();
The success callback to be invoked when an NFC peer-to-peer target is detected or lost.
[Callback, NoInterfaceObject] interface NFCPeerDetectCallback { void onattach(NFCPeer nfcPeer); void ondetach(); };
This callback interface specifies two methods:
It is used in NFCAdapter.setPeerListener().
onattach
The method invoked when the NFC peer-to-peer target is attached.
void onattach(NFCPeer nfcPeer);
ondetach
The method invoked when the NFC peer-to-peer target connected is detached.
void ondetach();
The success callback to be invoked when data has been read successfully from the NFC tag or target.
[Callback=FunctionOnly, NoInterfaceObject] interface NDEFMessageReadCallback { void onsuccess(NDEFMessage ndefMessage); };
This callback interface specifies a success method with an NDEF message as an input parameter. It is used in asynchronous operations, such as NFCTag.readNDEF() or NFCPeer.setReceiveNDEFListener().
onsuccess
The method invoked when the asynchronous call completes successfully.
void onsuccess(NDEFMessage ndefMessage);
The success callback to be invoked when NFCTag.transceive() completes successfully.
[Callback=FunctionOnly, NoInterfaceObject] interface ByteArraySuccessCallback { void onsuccess(byte[] data); };
This callback interface specifies a success method, with a raw data as an input parameter. It is used in NFCTag.transceive().
onsuccess
The method invoked when the asynchronous call completes successfully.
void onsuccess(byte[] data);
module NFC { enum NDEFRecordTextEncoding { "UTF8", "UTF16" }; enum NFCTagType { "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", "UNKNOWN_TARGET" }; [NoInterfaceObject] interface NFCManagerObject { readonly attribute NFCManager nfc; }; WebAPIs implements NFCManagerObject; [NoInterfaceObject] interface NFCManager { const short NFC_RECORD_TNF_EMPTY = 0; const short NFC_RECORD_TNF_WELL_KNOWN = 1; const short NFC_RECORD_TNF_MIME_MEDIA = 2; const short NFC_RECORD_TNF_URI = 3; const short NFC_RECORD_TNF_EXTERNAL_RTD = 4; const short NFC_RECORD_TNF_UNKNOWN = 5; const short NFC_RECORD_TNF_UNCHANGED = 6; NFCAdapter getDefaultAdapter() raises(WebAPIException); void setExclusiveMode(boolean mode) raises(WebAPIException); }; [NoInterfaceObject] interface NFCAdapter { readonly attribute boolean powered ; void setPowered(boolean state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void setTagListener(NFCTagDetectCallback detectCallback, optional NFCTagType[]? tagFilter) raises(WebAPIException); void setPeerListener(NFCPeerDetectCallback detectCallback) raises(WebAPIException); void unsetTagListener() raises(WebAPIException); void unsetPeerListener() raises(WebAPIException); NDEFMessage? getCachedMessage() raises(WebAPIException); }; [NoInterfaceObject] interface NFCTag { readonly attribute NFCTagType type; readonly attribute boolean isSupportedNDEF; readonly attribute long ndefSize; readonly attribute object properties; readonly attribute boolean isConnected; void readNDEF(NDEFMessageReadCallback readCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void writeNDEF(NDEFMessage ndefMessage, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void transceive(byte[] data, ByteArraySuccessCallback dataCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); }; [NoInterfaceObject] interface NFCPeer { readonly attribute boolean isConnected; void setReceiveNDEFListener(NDEFMessageReadCallback successCallback) raises(WebAPIException); void unsetReceiveNDEFListener() raises(WebAPIException); void sendNDEF(NDEFMessage ndefMessage, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); }; [Constructor(), Constructor(NDEFRecord[] ndefRecords), Constructor(byte[] rawData)] interface NDEFMessage { readonly attribute long recordCount; attribute NDEFRecord[] records; byte[] toByte() raises(WebAPIException); }; [Constructor(short tnf, byte[] type, byte[] payload, optional byte[]? id), Constructor(byte[] raw_data)] interface NDEFRecord { readonly attribute short tnf; readonly attribute byte[] type; readonly attribute byte[] id; readonly attribute byte[] payload; }; [Constructor(DOMString text, DOMString languageCode, optional DOMString? encoding)] interface NDEFRecordText : NDEFRecord { readonly attribute DOMString text; readonly attribute DOMString languageCode; readonly attribute NDEFRecordTextEncoding encoding; }; [Constructor(DOMString uri)] interface NDEFRecordURI : NDEFRecord { readonly attribute DOMString uri; }; [Constructor(DOMString mimeType, byte[] data)] interface NDEFRecordMedia : NDEFRecord { readonly attribute DOMString mimeType; }; [Callback, NoInterfaceObject] interface NFCTagDetectCallback { void onattach(NFCTag nfcTag); void ondetach(); }; [Callback, NoInterfaceObject] interface NFCPeerDetectCallback { void onattach(NFCPeer nfcPeer); void ondetach(); }; [Callback=FunctionOnly, NoInterfaceObject] interface NDEFMessageReadCallback { void onsuccess(NDEFMessage ndefMessage); }; [Callback=FunctionOnly, NoInterfaceObject] interface ByteArraySuccessCallback { void onsuccess(byte[] data); }; };