Tags: 2.5 Privileged


The Bluetooth API lets a packaged app discover, pair with, and connect to Bluetooth devices. As it is a experimental and non-standard API, the API is currently available for certified and privileged apps only. Notice that 'bluetooth' permission is required for using Bluetooth API.

Note: App developers who wish to send data to a Bluetooth device can use the share activity. This activity allows sharing of images, audio, video and vCard content only.

API overview

The main entry point for the API is the Navigator.mozBluetooth property, which returns a BluetoothManager object.

Basic interfaces

The following interfaces provide an app with basic Bluetooth functionality

  • BluetoothManager Allows access to all Bluetooth adapters available on the device. Adapters are the connection interface to connect another Bluetooth-enabled device to the current device.
  • BluetoothAdapter Used to handle all the operations requested by Bluetooth networks.
  • BluetoothClassOfDevice Provides identifying/classification information about a given remote Bluetooth device, available at discovery stage.
  • BluetoothDevice Provides information regarding a given remote Bluetooth device.
  • BluetoothDiscoveryHandle Used to notify the current application about the discovery of a remote bluetooth device.

Gatt interfaces

The following interfaces allow KaiOS to communicate with and consume Gatt (Generic Attribute Profile)-based services on remote Smart/LE (low energy) devices.

  • BluetoothGatt Handles initial communications and connections with Gatt services.
  • BluetoothGattService Represents a service provided by a GATT server, including the service definition, a list of included services, and a list of the characteristics of this service.
  • BluetoothGattCharacteristic Represents a GATT service characteristic, which includes characteristic definition, value, properties and configuration info, and a list of descriptors that provide related information.
  • BluetoothGattDescriptor Represents a GATT descriptor, which contains related information about a characteristic value.

Bluetooth event interfaces

These objects represent different events occuring within a Bluetooth interaction.

  • BluetoothAdapterEvent Provides access to a BluetoothAdapter object and its address as the parameter of a adapteradded or adapterremoved event handler (see BluetoothManager.onadapteradded and BluetoothManager.onadapterremoved), when fired.
  • BluetoothAttributeEvent Provides access to changed attributes and their new values as the parameter of attributechanged event handlers (including BluetoothManager.onattributechanged, BluetoothAdapter.onattributechanged, and BluetoothDevice.onattributechanged), when fired.
  • BluetoothDeviceEvent Provides access to a found/paired device (BluetoothDevice) object or the address or an unpaired device as the parameter of a devicefound, devicepaired or deviceunpaired event handler (see BluetoothDiscoveryHandle.ondevicefound, BluetoothAdapter.ondevicepaired, BluetoothAdapter.ondeviceunpaired), when fired.
  • BluetoothGattCharacteristicEvent Provides access to an updated BluetoothGattCharacteristic object as the parameter of the BluetoothGatt.oncharacteristicchanged, handler, when the characteristicchanged event is fired.
  • BluetoothLeDeviceEvent Provides access to an LE device BluetoothDevice object and its RSSI value and advertisement record, as the parameter of a devicefound event handler (see BluetoothDiscoveryHandle.ondevicefound), when fired.