public enum NfcError

  1. Object
  2. Enum<NfcError>
  3. NfcError

ImplementsComparable<NfcError>

Typed error codes returned by Nfc and HostCardEmulationService when an asynchronous NFC operation fails. Callers branch on these via NfcException.getError() instead of string-matching error messages.

Enum constants

NOT_AVAILABLEThe current platform/port does not expose an NFC API at all (desktop deploy, JavaScript, ports without getNfc() overridden).
DISABLEDDevice has NFC hardware but the user has disabled it in system settings.
NOT_AUTHORIZEDThe user did not grant the NFC entitlement / permission, or the build is missing the NFCReaderUsageDescription plist entry on iOS / the android.permission.NFC manifest entry on Android.
TAG_LOSTTag was removed from the field before the requested operation could complete.
INVALID_NDEFThe NDEF payload is malformed or the tag returned data that does not parse as a valid NDEF message.
READ_ONLYTag is read-only (already locked, or a vendor tag with no writable area) and the requested write was rejected.
CAPACITY_EXCEEDEDThe message did not fit in the tag’s writable capacity.
IO_ERRORI/O failure during transceive / NDEF read / NDEF write – typically a transient field loss that may succeed on retry.
UNSUPPORTED_TAGTag was discovered but reports a technology that the requested operation does not support (e.g. asking for IsoDep on a NDEF-only tag, or asking for FeliCa block reads on an NFC-A tag).
USER_CANCELEDUser dismissed the iOS Core NFC system sheet, or the Android foreground-dispatch overlay was cancelled.
SYSTEM_CANCELEDThe OS / NFC controller cancelled the session – app backgrounded, another reader took the radio, or the session timed out without a tag.
UNKNOWN_AIDHCE-specific: the requested AID is not the one registered for this service, or the terminal addressed an unknown AID.
UNKNOWNAnything not covered by the more specific codes.

Methods

public static NfcError[] values()
public static NfcError valueOf(String name)

Inherited methods

Enum constant details

NOT_AVAILABLE

NOT_AVAILABLE
The current platform/port does not expose an NFC API at all (desktop deploy, JavaScript, ports without getNfc() overridden). The fallback Nfc base class always fails read/write requests with this code.

DISABLED

DISABLED
Device has NFC hardware but the user has disabled it in system settings. On Android this corresponds to NfcAdapter.isEnabled() returning false; iOS does not expose a runtime toggle so this code is rarely returned there.

NOT_AUTHORIZED

NOT_AUTHORIZED
The user did not grant the NFC entitlement / permission, or the build is missing the NFCReaderUsageDescription plist entry on iOS / the android.permission.NFC manifest entry on Android.

TAG_LOST

TAG_LOST
Tag was removed from the field before the requested operation could complete. The caller should re-arm the reader and re-prompt the user.

INVALID_NDEF

INVALID_NDEF
The NDEF payload is malformed or the tag returned data that does not parse as a valid NDEF message.

READ_ONLY

READ_ONLY
Tag is read-only (already locked, or a vendor tag with no writable area) and the requested write was rejected.

CAPACITY_EXCEEDED

CAPACITY_EXCEEDED
The message did not fit in the tag’s writable capacity. See Tag.getMaxNdefSize() before constructing large messages.

IO_ERROR

IO_ERROR
I/O failure during transceive / NDEF read / NDEF write – typically a transient field loss that may succeed on retry.

UNSUPPORTED_TAG

UNSUPPORTED_TAG
Tag was discovered but reports a technology that the requested operation does not support (e.g. asking for IsoDep on a NDEF-only tag, or asking for FeliCa block reads on an NFC-A tag).

USER_CANCELED

USER_CANCELED
User dismissed the iOS Core NFC system sheet, or the Android foreground-dispatch overlay was cancelled.

SYSTEM_CANCELED

SYSTEM_CANCELED
The OS / NFC controller cancelled the session – app backgrounded, another reader took the radio, or the session timed out without a tag.

UNKNOWN_AID

UNKNOWN_AID
HCE-specific: the requested AID is not the one registered for this service, or the terminal addressed an unknown AID.

UNKNOWN

UNKNOWN
Anything not covered by the more specific codes.

Method details

values

public static NfcError[] values()

valueOf

public static NfcError valueOf(String name)