NFC Examples

The NFC object may be used to manage near-field communication operations with NFC tags on the device. With it, NFC data may be read and written to tags using expressions which will be trigged when upon contact.

Currently, this is supported on Android builds 8.1.6 and higher.

Example 1. Turn NFC object on

NFC.Enable()

Note:

Example 2. Determine last event type and load the tag value if read.

IF(NFC.GetEventType() == NFC_READ)

{

    IF(NFC.GetLastError() == 0)

    {

        edit_control1 = NFC.ReadString();

    }

    ELSE

    {

        Form.MessageBox("NFC Tag", "Could not read tag.", 0);

    }

}

Note:

Example 3. Write to an NFC Tag.

local.vResult = NFC.WriteAsText(local.vParam1);

Note:

IF(NFC.GetEventType() == NFC_WRITE)

{

    IF(NFC.GetLastError() == 0)

    {

        Form.MessageBox("NFC Tag", "NFC tag written successfully.", 0);

    }

    ELSE

    {

        Form.MessageBox("NFC Tag", "Could not write tag.", 0);

    }

}

Note:

 

Example 4. Turn the NFC object off.

NFC.Disable()

Note: