Enum NfcError

java.lang.Object
java.lang.Enum<NfcError>
com.codename1.nfc.NfcError
All Implemented Interfaces:
Comparable<NfcError>

public enum NfcError extends Enum<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 Constant Summary

    Enum Constants
    Enum Constant
    Description
    The message did not fit in the tag's writable capacity.
    Device has NFC hardware but the user has disabled it in system settings.
    The NDEF payload is malformed or the tag returned data that does not parse as a valid NDEF message.
    I/O failure during transceive / NDEF read / NDEF write -- typically a transient field loss that may succeed on retry.
    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.
    The current platform/port does not expose an NFC API at all (desktop deploy, JavaScript, ports without getNfc() overridden).
    Tag is read-only (already locked, or a vendor tag with no writable area) and the requested write was rejected.
    The OS / NFC controller cancelled the session -- app backgrounded, another reader took the radio, or the session timed out without a tag.
    Tag was removed from the field before the requested operation could complete.
    Anything not covered by the more specific codes.
    HCE-specific: the requested AID is not the one registered for this service, or the terminal addressed an unknown AID.
    Tag was discovered but reports a technology that the requested operation does not support (e.g.
    User dismissed the iOS Core NFC system sheet, or the Android foreground-dispatch overlay was cancelled.
  • Method Summary

    Modifier and Type
    Method
    Description
    static NfcError
    Returns the enum constant of this type with the specified name.
    static NfcError[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NOT_AVAILABLE

      public static final NfcError 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

      public static final NfcError 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

      public static final NfcError 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

      public static final NfcError 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

      public static final NfcError INVALID_NDEF
      The NDEF payload is malformed or the tag returned data that does not parse as a valid NDEF message.
    • READ_ONLY

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

      public static final NfcError CAPACITY_EXCEEDED
      The message did not fit in the tag's writable capacity. See Tag.getMaxNdefSize() before constructing large messages.
    • IO_ERROR

      public static final NfcError IO_ERROR
      I/O failure during transceive / NDEF read / NDEF write -- typically a transient field loss that may succeed on retry.
    • UNSUPPORTED_TAG

      public static final NfcError 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

      public static final NfcError USER_CANCELED
      User dismissed the iOS Core NFC system sheet, or the Android foreground-dispatch overlay was cancelled.
    • SYSTEM_CANCELED

      public static final NfcError 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

      public static final NfcError UNKNOWN_AID
      HCE-specific: the requested AID is not the one registered for this service, or the terminal addressed an unknown AID.
    • UNKNOWN

      public static final NfcError UNKNOWN
      Anything not covered by the more specific codes.
  • Method Details

    • values

      public static NfcError[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static NfcError valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null