NFC Plugin

Stable Version 1.0.4 (Compatible with OutSystems 11)
Other versions available for 10
Published on 4 Jun by 
4.6
 (5 ratings)

NFC Plugin

Details
Leverage NFC functionalities on your mobile apps. Supports iOS and Android
Read More

Read, write and share data through NFC. This plugin encapsulates the functionalities available on https://github.com/OutSystems/phonegap-nfc, providing an easy to use set of client actions and web blocks.


Reading NFC data


Reading data from NFC sensor is an asynchronous process and is possible using one of the following web blocks:

  • MimeTypeListener: Listens to any NFC Tag that has data with a specific mime type (i.e. “text/plain”). This listener takes precedence over NdefListener.

    Usage is as simple as dragging and dropping into any container and specifying a mime type and callback.

    Note: Only TAGs containing records of type RTD_TEXT or RTD_URI are supported.

  • NdefListener: Listens to any NFC Tag containing an NDEF Message. MimeTypeListener takes precedence over this more generic listener.

    Just like MimeTypeListener, usage is straightforward. Just drag and drop into a container and assign a callback.

    Note: Only TAGs containing records of type RTD_TEXT or RTD_URI will be decoded. However, the RAW data is available for advanced usages.


Writing NFC data


Writing data to NFC TAGs is easily done with the following client actions:

  • WriteText: Write a single text record into an NFC TAG.

    Warning: Will override the content of the NFC TAG.

  • WriteDataRecords: Write one or more NDEF records into an NFC TAG (See NfcWriteRecord).

Receiving feedback on the write process is possible using WriteProgress web block.


Share


Sharing data between two NFC enabled devices is as simple as touching the devices. Using this functionality is as simple as using one of the following actions:

  • ShareText: Share, once, a text record with another device.

  • StartSharing: Enables NFC sharing on the device until StopSharing action is executed.

    This gives the ability to share the same information with several different devices.

To receive feedback on the sharing process, use ShareProgress web block.

What’s new (1.0.4)
  • Added IsNFCEnabled action that will check if NFC is enabled, also outputting the reason why is not enabled.
    • The reason will be NO_NFC if the device doesn't support NFC and NFC_DISABLED if the user has disabled NFC.
  • Code clean up.
  • Removed excessive console.log usage. Moved the log messages to the action outputs. This will allow the consumer apps to decide what to do with the messages.
  • Removed unused references.
  • Demo App updated with last changes.
    • Code clean up.
    • Removed unused references
Reviews (0)
More from Experts