NFC API

'NFC' external object was designed to help users create applications that can interact with NFC tags. 

This feature requires a device with compatible hardware.

Compatibility: Android

 

Structure

This external object includes the following functions:

nativemobile_api_nfc_struct

StartListening

Starts listening for NFC tag events in the background. Users can continue executing any logic, but if the application goes to the background or a new Panel is invoked, NFC events will not be received.

After the API starts listening, if an NFC Tag is put near the device, the event 'OnTagFound' will be fired.

StopListening

If the API was listening in the background, this method will stop listening for NFC events. This means that if an NFC Tag is put near the device, the API will not react.

WriteTag

Starts listening for NFC tag, but on 'write' mode. This means that if an NFC Tag is put near the device, the API will try to write down the provided information in the Tag.

This will fire the 'OnWriteTagEnded' event with the result of the 'write' action, either it is successful or not.

Templates

The following templates are distributed:

NFC Tag scanner

Shows an example of how to use the API to scan and show a message with the TAG information

nativemobile_template_TagScanner  

NFC Tag writer

Shows an example of how to write content in the TAG

nativemobile_template_TagWriter