public enum BluetoothError

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

ImplementsComparable<BluetoothError>

Typed error codes carried by every BluetoothException fired through the failure path of the asynchronous Bluetooth APIs. Callers branch on these via BluetoothException.getError() instead of string-matching messages.

Enum constants

NOT_SUPPORTEDThe requested feature is not available on this port or device.
POWERED_OFFThe adapter is powered off or otherwise unavailable.
UNAUTHORIZEDA required runtime permission or OS authorization is missing – Android 12+ BLUETOOTH_SCAN/BLUETOOTH_CONNECT/BLUETOOTH_ADVERTISE runtime grants, location on older Android, or the iOS Bluetooth privacy authorization.
SCAN_FAILEDThe OS refused to start a scan or aborted a running one (throttling, too many concurrent scans, hardware error).
ADVERTISE_FAILEDAdvertising could not be started – payload too large, too many concurrent advertisers, or hardware limitation.
CONNECTION_FAILEDA connection attempt failed or timed out before it was established.
CONNECTION_LOSTAn established link dropped unexpectedly.
NOT_CONNECTEDA GATT operation was attempted while the peripheral is not connected.
GATT_ERRORATT-level failure reported by the remote GATT server.
BOND_FAILEDBonding/pairing failed or was rejected by the remote device.
TIMEOUTThe platform never delivered a completion callback for an operation within the safety timeout.
BUSYResource conflict – e.g. an RFCOMM channel is already in use or the adapter is busy with a conflicting operation.
IO_ERRORTransport I/O failure on a non-stream operation.
USER_CANCELEDThe user dismissed a system dialog (enable request, pairing prompt, device chooser) or the operation was cancelled via AsyncResource.cancel().
UNKNOWNUnclassified failure; the exception message carries the details.

Methods

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

Inherited methods

Enum constant details

NOT_SUPPORTED

NOT_SUPPORTED
The requested feature is not available on this port or device. Capability queries such as Bluetooth.isLeSupported() let cross-platform code branch before ever seeing this code; the no-op fallback base classes fail every operation with it.

POWERED_OFF

POWERED_OFF
The adapter is powered off or otherwise unavailable. Ask the user to enable Bluetooth, optionally via Bluetooth.requestEnable().

UNAUTHORIZED

UNAUTHORIZED
A required runtime permission or OS authorization is missing – Android 12+ BLUETOOTH_SCAN/BLUETOOTH_CONNECT/BLUETOOTH_ADVERTISE runtime grants, location on older Android, or the iOS Bluetooth privacy authorization. See Bluetooth.requestPermissions.

SCAN_FAILED

SCAN_FAILED
The OS refused to start a scan or aborted a running one (throttling, too many concurrent scans, hardware error).

CONNECTION_FAILED

CONNECTION_FAILED
A connection attempt failed or timed out before it was established.

CONNECTION_LOST

CONNECTION_LOST
An established link dropped unexpectedly. Delivered as the reason of the disconnection event and used to fail operations that were in-flight when the link died.

NOT_CONNECTED

NOT_CONNECTED
A GATT operation was attempted while the peripheral is not connected.

GATT_ERROR

GATT_ERROR
ATT-level failure reported by the remote GATT server. BluetoothException.getGattStatus() carries the raw status code.

BOND_FAILED

BOND_FAILED
Bonding/pairing failed or was rejected by the remote device.

TIMEOUT

TIMEOUT
The platform never delivered a completion callback for an operation within the safety timeout. The internal per-peripheral operation queue fails the operation with this code and moves on rather than wedging.

BUSY

BUSY
Resource conflict – e.g. an RFCOMM channel is already in use or the adapter is busy with a conflicting operation.

IO_ERROR

IO_ERROR
Transport I/O failure on a non-stream operation. Stream reads/writes on RFCOMM/L2CAP throw plain java.io.IOException instead.

USER_CANCELED

USER_CANCELED
The user dismissed a system dialog (enable request, pairing prompt, device chooser) or the operation was cancelled via AsyncResource.cancel().

UNKNOWN

UNKNOWN
Unclassified failure; the exception message carries the details.

Method details

values

public static BluetoothError[] values()

valueOf

public static BluetoothError valueOf(String name)