Build with Android NFC (support ended July 2023)

United States
Canada
Europe
Latin America

🚧

IMPORTANT—Support ended for Android NFC feature from July 2023

With the launch of the third generation of Clover Flex and Mini devices, we no longer support the Android NFC (Near Field Communication) feature.

  • In the third generation Clover devices, you can use alternatives to the Android NFC feature, such as external USB NFC readers.
  • In earlier Clover devices, such as Clover Station 2018, Mini2, Flex1, and Flex2, you can still use Android NFC; however, we do not actively support this feature.

Android API level: Using Android API level 19 onwards, you can build NFC solutions to read and write data payloads between a tag and a Clover device.

Clover devices: NFC reader and writer modes are available in the following devices:

  • Clover Station 2018 with display printer
  • Clover Mini 2
  • Clover Flex

Clover device guidelines

The required considerations for building with Android NFC on Clover devices are:

  • Conserve power: To account for thermal and power considerations on Clover devices, do not enable NFC for your app at all times. We recommend enabling NFC for your app only when a tag is detected. If no tag is detected for 10 minutes, NFC is automatically turned off. At this point, you can enable NFC again by moving your app to the foreground.
  • Show NFC states: Indicates the current NFC state, for instance, with a spinner, by implementing a broadcast receiver for theACTION_ADAPTER_STATE_CHANGED action.
  • Supported signal and tag modes: Different signal and tag modes supported by Clover devices:
Signal modeTag mode
NFC-A, NFC-B, NFC-FT1T, T2T, T3T, T4T

Use the NfcAdapter class

This section provides guidelines for using the Android NfcAdapter class in your app.

Enable the NFC reader

The NFC antenna is enabled only when your app is in the foreground. In the foreground activity, your app must call the following methods of the NfcAdapter class:

  • enableForegroundDispatch() when onResume() is called
  • disableForegroundDispatch() when onPause() is called
    If a window is added over an activity, both the NFC reader and writer modes are disabled.
    Clover devices support three NFC states defined by the NfcAdapter class:
StateDescription
STATE_ONNFC field is enabled on the Clover device.
STATE_TURNING_ONNFC field is being initialized. Your app can show the current NFC state by implementing a broadcast receiver for the ACTION_ADAPTER_STATE_CHANGED action.
STATE_OFFNFC is not supported by the Clover device.

📘

NOTE

Clover devices do not support the STATE_TURNING_OFF NFC state of the NfcAdapter class.

Receive notifications

To receive notifications about tags, register for the following intents:

ACTION_NDEF_DISCOVERED
ACTION_TAG_DISCOVERED
ACTION_TECH_DISCOVERED

Security limitations

To maintain security, Clover does not support Android Beam and any related callbacks. The following methods of the NfcAdapter class are not supported:

enableForegroundNdefPush()
enableReaderMode()
invokeBeam()
setBeamPushUris()
setBeamPushUrisCallback()
setNdefPushMessage()
setNdefPushMessageCallback()
setOnNdefPushCompleteCallback()

Communication with HCE

The Android system uses the Application ID (AIDs) of an NFC device or tag to identify a Host-based card emulation (HCE) service with which to communicate. Clover automatically lets all non-payment AIDs but blocks Payment AIDs that start with 0xA00000.

For more information on: