Enum BluetoothPermission

java.lang.Object
java.lang.Enum<BluetoothPermission>
com.codename1.bluetooth.BluetoothPermission
All Implemented Interfaces:
Comparable<BluetoothPermission>

public enum BluetoothPermission extends Enum<BluetoothPermission>

The runtime permissions the Bluetooth API may need, abstracted across platforms. Query with Bluetooth.hasPermission(BluetoothPermission) and request with Bluetooth.requestPermissions(BluetoothPermission...).

Mapping per platform:

  • Android 12+ -- BLUETOOTH_SCAN / BLUETOOTH_CONNECT / BLUETOOTH_ADVERTISE runtime permissions respectively.
  • Android 6-11 -- SCAN maps to ACCESS_FINE_LOCATION (required for BLE scan results); CONNECT and ADVERTISE need no runtime grant.
  • iOS -- a single Bluetooth privacy authorization covers all three.
  • Enum Constant Details

    • SCAN

      public static final BluetoothPermission SCAN
      Discovering nearby devices (BLE scanning, classic discovery).
    • CONNECT

      public static final BluetoothPermission CONNECT
      Connecting to devices and using GATT / RFCOMM / L2CAP.
  • Method Details

    • values

      public static BluetoothPermission[] 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 BluetoothPermission 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