Skip to content

@capawesome-team/capacitor-bluetooth-low-energy

Capacitor plugin for Bluetooth Low Energy (BLE) communication in the central role.

Features

  • 🖥️ Cross-platform: Supports Android and iOS.
  • 🦾 Headless Task: Add custom native code for specific events.
  • 🌙 Foreground Service: Keep the connection alive even when the app is in the background.
  • Command Queue: Queue up incoming commands to prevent operation failures.
  • 📱 Multiple Devices: Connect to multiple devices at the same time.
  • 🛠️ Utils: Utility functions to make your life easier.
  • 🔁 Up-to-date: Always supports the latest Capacitor version.
  • ⭐️ Support: First-class support from the Capawesome Team.

Installation

This plugin is only available to Capawesome Insiders. First, make sure you have the Capawesome npm registry set up. You can do this by running the following commands:

npm config set @capawesome-team:registry https://npm.registry.capawesome.io
npm config set //npm.registry.capawesome.io/:_authToken <YOUR_LICENSE_KEY>

Attention: Replace <YOUR_LICENSE_KEY> with the license key you received from Polar. If you don't have a license key yet, you can get one by becoming a Capawesome Insider.

Next, install the package:

npm install @capawesome-team/capacitor-bluetooth-low-energy
npx cap sync

Android

Permissions

This API requires the following permissions be added to your AndroidManifest.xml before or after the application tag:

<!-- Needed only if your app looks for Bluetooth devices.  -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<!-- Needed only if your app communicates with already-paired Bluetooth devices. -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<!-- Needed only if your app uses Bluetooth scan results to derive physical location. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Needed only if your app uses the foreground service. -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

You can read more about Bluetooth permissions in the Android documentation.

Services

You also need to add the following service inside the application tag in your AndroidManifest.xml (usually android/app/src/main/AndroidManifest.xml):

<service android:name="io.capawesome.capacitorjs.plugins.bluetoothle.BluetoothLowEnergyService" android:foregroundServiceType="connectedDevice" />

Headless Task

If you want to run your own native code when a specific event occurs, you can create a headless task. For this, you need to create a Java class with the name BluetoothLowEnergyHeadlessTask in the same package as your MainActivity. Then you need to add the onCharacteristicChanged method to your class:

import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import androidx.annotation.NonNull;

public class BluetoothLowEnergyHeadlessTask {
  public void onCharacteristicChanged(@NonNull BluetoothGatt gatt, @NonNull BluetoothGattCharacteristic characteristic, @NonNull byte[] value) {
    // Your code here
  }
}

iOS

Add the NSBluetoothPeripheralUsageDescription and NSBluetoothAlwaysUsageDescription keys to the Info.plist file (usually ios/App/App/Info.plist), which tells the user why the app needs access to Bluetooth peripherals:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>The app needs access to Bluetooth peripherals to communicate with Bluetooth devices.</string>

If the app wants to use Bluetooth in the background, add the UIBackgroundModes key with the bluetooth-central value:

<key>UIBackgroundModes</key>
<array>
    <string>bluetooth-central</string>
</array>

Configuration

No configuration required for this plugin.

Demo

A working example can be found here: robingenz/capacitor-plugin-demo

Usage

import { BluetoothLowEnergy, BluetoothLowEnergyUtils, ConnectionPriority } from '@capawesome-team/capacitor-bluetooth-low-energy';

const connect = async () => {
  await BluetoothLowEnergy.connect({ deviceId: '00:00:00:00:00:00' });
};

const createBond = async () => {
  await BluetoothLowEnergy.createBond({ deviceId: '00:00:00:00:00:00' });
};

const disconnect = async () => {
  await BluetoothLowEnergy.disconnect({ deviceId: '00:00:00:00:00:00' });
};

const discoverServices = async () => {
  await BluetoothLowEnergy.discoverServices({ deviceId: '00:00:00:00:00:00' });
};

const getConnectedDevices = async () => {
  const result = await BluetoothLowEnergy.getConnectedDevices();
  return result.devices;
};

const getServices = async () => {
  const result = await BluetoothLowEnergy.getServices({ deviceId: '00:00:00:00:00:00' });
  return result.services;
};

const initialize = async () => {
  await BluetoothLowEnergy.initialize();
};

const isBonded = async () => {
  const result = await BluetoothLowEnergy.isBonded({ deviceId: '00:00:00:00:00:00' });
  return result.bonded;
};

const isEnabled = async () => {
  const result = await BluetoothLowEnergy.isEnabled();
  return result.enabled;
};

const openAppSettings = async () => {
  await BluetoothLowEnergy.openAppSettings();
};

const openBluetoothSettings = async () => {
  await BluetoothLowEnergy.openBluetoothSettings();
};

const openLocationSettings = async () => {
  await BluetoothLowEnergy.openLocationSettings();
};

const readCharacteristic = async () => {
  const result = await BluetoothLowEnergy.readCharacteristic({
    characteristicId: '00002a00-0000-1000-8000-00805f9b34fb',
    deviceId: '00:00:00:00:00:00',
    serviceId: '00001800-0000-1000-8000-00805f9b34fb',
  });
  return result.value;
};

const readDescriptor = async () => {
  const result = await BluetoothLowEnergy.readDescriptor({
    characteristicId: '00002a00-0000-1000-8000-00805f9b34fb',
    descriptorId: '00002902-0000-1000-8000-00805f9b34fb',
    deviceId: '00:00:00:00:00:00',
    serviceId: '00001800-0000-1000-8000-00805f9b34fb',
  });
  return result.value;
};

const readRssi = async () => {
  const result = await BluetoothLowEnergy.readRssi({ deviceId: '00:00:00:00:00:00' });
  return result.rssi;
};

const requestConnectionPriority = async () => {
  await BluetoothLowEnergy.requestConnectionPriority({
    connectionPriority: ConnectionPriority.BALANCED,
    deviceId: '00:00:00:00:00:00',
  });
};

const requestMtu = async () => {
  await BluetoothLowEnergy.requestMtu({
    deviceId: '00:00:00:00:00:00',
    mtu: 512,
  });
};

const startCharacteristicNotifications = async () => {
  await BluetoothLowEnergy.startCharacteristicNotifications({
    characteristicId: '00002a00-0000-1000-8000-00805f9b34fb',
    deviceId: '00:00:00:00:00:00',
    serviceId: '00001800-0000-1000-8000-00805f9b34fb',
  });
};

const startForegroundService = async () => {
  await BluetoothLowEnergy.startForegroundService({
    body: 'Body',
    id: 1,
    smallIcon: 'smallIcon',
    title: 'Title',
  });
};

const startScan = async () => {
  await BluetoothLowEnergy.startScan();
};

const stopCharacteristicNotifications = async () => {
  await BluetoothLowEnergy.stopCharacteristicNotifications({
    characteristicId: '00002a00-0000-1000-8000-00805f9b34fb',
    deviceId: '00:00:00:00:00:00',
    serviceId: '00001800-0000-1000-8000-00805f9b34fb',
  });
};

const stopForegroundService = async () => {
  await BluetoothLowEnergy.stopForegroundService();
};

const stopScan = async () => {
  await BluetoothLowEnergy.stopScan();
};

const writeCharacteristic = async () => {
  await BluetoothLowEnergy.writeCharacteristic({
    characteristicId: '00002a00-0000-1000-8000-00805f9b34fb',
    deviceId: '00:00:00:00:00:00',
    serviceId: '00001800-0000-1000-8000-00805f9b34fb',
    value: [1, 2, 3],
  });
};

const writeDescriptor = async () => {
  await BluetoothLowEnergy.writeDescriptor({
    characteristicId: '00002a00-0000-1000-8000-00805f9b34fb',
    descriptorId: '00002902-0000-1000-8000-00805f9b34fb',
    deviceId: '00:00:00:00:00:00',
    serviceId: '00001800-0000-1000-8000-00805f9b34fb',
    value: [1, 2, 3],
  });
};

const checkPermissions = async () => {
  const result = await BluetoothLowEnergy.checkPermissions();
  return result;
};

const requestPermissions = async () => {
  const result = await BluetoothLowEnergy.requestPermissions();
  return result;
};

const addListener = () => {
  BluetoothLowEnergy.addListener('characteristicChanged', (event) => {
    console.log('Characteristic changed', event);
  });

  BluetoothLowEnergy.addListener('deviceDisconnected', (event) => {
    console.log('Device disconnected', event);
  });

  BluetoothLowEnergy.addListener('deviceScanned', (event) => {
    console.log('Device scanned', event);
  });
};

const removeAllListeners = () => {
  BluetoothLowEnergy.removeAllListeners();
};

const convertBytesToHex = (bytes: number[]) => {
  return BluetoothLowEnergyUtils.convertBytesToHex({ bytes });
};

API

connect(...)

connect(options: ConnectOptions) => Promise<void>

Connect to a BLE device.

Only available on Android and iOS.

Param Type
options ConnectOptions

Since: 6.0.0


createBond(...)

createBond(options: CreateBondOptions) => Promise<void>

Create a bond with the BLE device.

Only available on Android.

Param Type
options CreateBondOptions

Since: 6.0.0


disconnect(...)

disconnect(options: DisconnectOptions) => Promise<void>

Disconnect from the BLE device.

Only available on Android and iOS.

Param Type
options DisconnectOptions

Since: 6.0.0


discoverServices(...)

discoverServices(options: DiscoverServiceOptions) => Promise<void>

Discover services provided by the device.

On iOS, this operation may take up to 30 seconds.

Only available on Android and iOS.

Param Type
options DiscoverServiceOptions

Since: 6.0.0


getConnectedDevices()

getConnectedDevices() => Promise<GetConnectedDevicesResult>

Get a list of connected devices.

Only available on Android and iOS.

Returns: Promise<GetConnectedDevicesResult>

Since: 6.0.0


getServices(...)

getServices(options: GetServicesOptions) => Promise<GetServicesResult>

Get a list of services provided by the device.

Only available on Android and iOS.

Param Type
options GetServicesOptions

Returns: Promise<GetServicesResult>

Since: 6.0.0


initialize()

initialize() => Promise<void>

Initialize the plugin. This method must be called before any other method.

On iOS, this will prompt the user for Bluetooth permissions.

Only available on iOS.

Since: 6.0.0


isBonded(...)

isBonded(options: IsBondedOptions) => Promise<IsBondedResult>

Check if the device is bonded.

Only available on Android.

Param Type
options IsBondedOptions

Returns: Promise<IsBondedResult>

Since: 6.0.0


isEnabled()

isEnabled() => Promise<IsEnabledResult>

Check if Bluetooth is enabled.

Only available on Android and iOS.

Returns: Promise<IsEnabledResult>

Since: 6.0.0


openAppSettings()

openAppSettings() => Promise<void>

Open the Bluetooth settings on the device.

Only available on Android and iOS.

Since: 6.0.0


openBluetoothSettings()

openBluetoothSettings() => Promise<void>

Open the Bluetooth settings on the device.

Only available on Android.

Since: 6.0.0


openLocationSettings()

openLocationSettings() => Promise<void>

Open the location settings on the device.

Only available on Android.

Since: 6.0.0


readCharacteristic(...)

readCharacteristic(options: ReadCharacteristicOptions) => Promise<ReadCharacteristicResult>

Read the value of a characteristic.

Only available on Android and iOS.

Param Type
options ReadCharacteristicOptions

Returns: Promise<ReadCharacteristicResult>

Since: 6.0.0


readDescriptor(...)

readDescriptor(options: ReadDescriptorOptions) => Promise<ReadDescriptorResult>

Read the value of a descriptor.

Only available on Android and iOS.

Param Type
options ReadDescriptorOptions

Returns: Promise<ReadDescriptorResult>

Since: 6.0.0


readRssi(...)

readRssi(options: ReadRssiOptions) => Promise<ReadRssiResult>

Read the RSSI value of the device.

Only available on Android and iOS.

Param Type
options ReadRssiOptions

Returns: Promise<ReadRssiResult>

Since: 6.0.0


requestConnectionPriority(...)

requestConnectionPriority(options: RequestConnectionPriorityOptions) => Promise<void>

Request a connection priority.

Only available on Android.

Param Type
options RequestConnectionPriorityOptions

Since: 6.0.0


requestMtu(...)

requestMtu(options: RequestMtuOptions) => Promise<void>

Request an MTU size.

Only available on Android.

Param Type
options RequestMtuOptions

Since: 6.0.0


startCharacteristicNotifications(...)

startCharacteristicNotifications(options: StartCharacteristicNotificationsOptions) => Promise<void>

Start listening for characteristic value changes. This will emit the characteristicChanged event when a value changes.

Only available on Android and iOS.

Param Type
options StartCharacteristicNotificationsOptions

Since: 6.0.0


startForegroundService(...)

startForegroundService(options: StartForegroundServiceOptions) => Promise<void>

Start the foreground service.

Only available on Android.

Param Type
options StartForegroundServiceOptions

Since: 6.0.0


startScan(...)

startScan(options?: StartScanOptions | undefined) => Promise<void>

Start scanning for BLE devices. This will emit the deviceScanned event when a device is found.

Only available on Android and iOS.

Param Type
options StartScanOptions

Since: 6.0.0


stopCharacteristicNotifications(...)

stopCharacteristicNotifications(options: StopCharacteristicNotificationsOptions) => Promise<void>

Stop listening for characteristic value changes.

Only available on Android and iOS.

Param Type
options StopCharacteristicNotificationsOptions

Since: 6.0.0


stopForegroundService()

stopForegroundService() => Promise<void>

Stop the foreground service.

Only available on Android.

Since: 6.0.0


stopScan()

stopScan() => Promise<void>

Stop scanning for BLE devices.

Only available on Android and iOS.

Since: 6.0.0


writeCharacteristic(...)

writeCharacteristic(options: WriteCharacteristicOptions) => Promise<void>

Write a value to a characteristic.

Only available on Android and iOS.

Param Type
options WriteCharacteristicOptions

Since: 6.0.0


writeDescriptor(...)

writeDescriptor(options: WriteDescriptorOptions) => Promise<void>

Write a value to a descriptor.

Only available on Android and iOS.

Param Type
options WriteDescriptorOptions

Since: 6.0.0


checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Check permissions for the plugin.

Only available on Android.

Returns: Promise<PermissionStatus>

Since: 6.0.0


requestPermissions(...)

requestPermissions(permissions?: BluetoothLowEnergyPluginPermission | undefined) => Promise<PermissionStatus>

Request permissions for the plugin.

Only available on Android.

Param Type
permissions BluetoothLowEnergyPluginPermission

Returns: Promise<PermissionStatus>

Since: 6.0.0


addListener('characteristicChanged', ...)

addListener(eventName: 'characteristicChanged', listenerFunc: (event: CharacteristicChangedEvent) => void) => Promise<PluginListenerHandle>

Called when a characteristic value changes.

Only available on Android and iOS.

Param Type
eventName 'characteristicChanged'
listenerFunc (event: CharacteristicChangedEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 6.0.0


addListener('deviceDisconnected', ...)

addListener(eventName: 'deviceDisconnected', listenerFunc: (event: DeviceDisconnectedEvent) => void) => Promise<PluginListenerHandle>

Called when a device is disconnected.

Only available on Android and iOS.

Param Type
eventName 'deviceDisconnected'
listenerFunc (event: DeviceDisconnectedEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 6.0.0


addListener('deviceScanned', ...)

addListener(eventName: 'deviceScanned', listenerFunc: (event: DeviceScannedEvent) => void) => Promise<PluginListenerHandle>

Called when an error occurs during the scan session.

Only available on Android and iOS.

Param Type
eventName 'deviceScanned'
listenerFunc (event: DeviceScannedEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 6.0.0


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all listeners for this plugin.

Since: 6.0.0


Interfaces

ConnectOptions

Prop Type Description Default Since
deviceId string The address of the device to connect to. 6.0.0
timeout number The timeout for the connect operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 10000 6.0.0

CreateBondOptions

Prop Type Description Default Since
deviceId string The address of the device to create a bond with. 6.0.0
timeout number The timeout for the create bond operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 10000 6.0.0

DisconnectOptions

Prop Type Description Default Since
deviceId string The address of the device to disconnect from. 6.0.0
timeout number The timeout for the disconnect operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 5000 6.0.0

DiscoverServiceOptions

Prop Type Description Default Since
deviceId string The address of the device to discover services for. 6.0.0
timeout number The timeout for the discover services operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 20000 6.0.0

GetConnectedDevicesResult

Prop Type Description Since
devices Device[] An array of connected devices. 6.0.0

Device

Prop Type Description Since
id string The UUID of the connected device. 6.0.0
name string The name of the connected device. 6.0.0

GetServicesResult

Prop Type Description Since
services Service[] An array of services provided by the device. 6.0.0

Service

Prop Type Description Since
id string The UUID of the service. 6.0.0
characteristics Characteristic[] The characteristics of the service. 6.0.0

Characteristic

Prop Type Description Since
id string The UUID of the characteristic. 6.0.0
descriptors Descriptor[] The descriptors of the characteristic. 6.0.0
properties CharacteristicProperties The properties of the characteristic. 6.0.0

Descriptor

Prop Type Description Since
id string The UUID of the descriptor. 6.0.0

CharacteristicProperties

Prop Type Description Since
broadcast boolean Whether or not the characteristic can be broadcast. 6.0.0
read boolean Whether or not the characteristic can be read. 6.0.0
writeWithoutResponse boolean Whether or not the characteristic can be written without response. 6.0.0
write boolean Whether or not the characteristic can be written. 6.0.0
notify boolean Whether or not the characteristic supports notifications. 6.0.0
indicate boolean Whether or not the characteristic supports indications. 6.0.0
authenticatedSignedWrites boolean Whether or not the characteristic supports signed writes. 6.0.0
extendedProperties boolean Whether or not the characteristic supports extended properties. 6.0.0
notifyEncryptionRequired boolean Whether or not the characteristic supports reliable writes. 6.0.0
indicateEncryptionRequired boolean Whether or not the characteristic supports writable auxiliaries. 6.0.0

GetServicesOptions

Prop Type Description Default Since
deviceId string The address of the device to get the services for. 6.0.0
timeout number The timeout for the get services operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 5000 6.0.0

IsBondedResult

Prop Type Description Since
bonded boolean Whether or not the device is bonded. 6.0.0

IsBondedOptions

Prop Type Description Since
deviceId string The address of the device to check if it is bonded. 6.0.0
timeout number The timeout for the is bonded operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 6.0.0

IsEnabledResult

Prop Type Description Since
enabled boolean Whether or not Bluetooth is enabled. 6.0.0

ReadCharacteristicResult

Prop Type Description Since
value number[] The value bytes of the characteristic. 6.0.0

ReadCharacteristicOptions

Prop Type Description Default Since
characteristicId string The UUID of the characteristic to read. 6.0.0
deviceId string The address of the device to read the characteristic from. 6.0.0
serviceId string The UUID of the service to read the characteristic from. 6.0.0
timeout number The timeout for the read operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 5000 6.0.0

ReadDescriptorResult

Prop Type Description Since
value number[] The value bytes of the descriptor. 6.0.0

ReadDescriptorOptions

Prop Type Description Default Since
characteristicId string The UUID of the characteristic that the descriptor belongs to. 6.0.0
descriptorId string The UUID of the descriptor to read. 6.0.0
deviceId string The address of the device to read the descriptor from. 6.0.0
serviceId string The UUID of the service that the descriptor belongs to. 6.0.0
timeout number The timeout for the read operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 5000 6.0.0

ReadRssiResult

Prop Type Description Since
rssi number The RSSI value. 6.0.0

ReadRssiOptions

Prop Type Description Default Since
deviceId string The address of the device to read the RSSI for. 6.0.0
timeout number The timeout for the read RSSI operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 5000 6.0.0

RequestConnectionPriorityOptions

Prop Type Description Since
deviceId string The address of the device to request the connection priority for. 6.0.0
connectionPriority ConnectionPriority The connection priority to request. 6.0.0
timeout number The timeout for the request connection priority operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 6.0.0

RequestMtuOptions

Prop Type Description Since
deviceId string The address of the device to request the MTU size for. 6.0.0
mtu number The mtu size to request. 6.0.0
timeout number The timeout for the request MTU operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 6.0.0

StartCharacteristicNotificationsOptions

Prop Type Description Default Since
characteristicId string The UUID of the characteristic to start notifications for. 6.0.0
deviceId string The address of the device to start notifications for. 6.0.0
serviceId string The UUID of the service to start notifications for. 6.0.0
timeout number The timeout for the start notifications operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 5000 6.0.0

StartForegroundServiceOptions

Prop Type Description Since
body string The body of the notification, shown below the title. 6.0.0
id number The notification identifier. 6.0.0
smallIcon string The status bar icon for the notification. Icons should be placed in your app's res/drawable folder. The value for this option should be the drawable resource ID, which is the filename without an extension. 6.0.0
title string The title of the notification. 6.0.0

StartScanOptions

Prop Type Description Since
serviceIds string[] Find devices with services that match any of the provided UUIDs. Only available on iOS. 6.0.0

StopCharacteristicNotificationsOptions

Prop Type Description Default Since
characteristicId string The UUID of the characteristic to stop notifications for. 6.0.0
deviceId string The address of the device to stop notifications for. 6.0.0
serviceId string The UUID of the service to stop notifications for. 6.0.0
timeout number The timeout for the stop notifications operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 5000 6.0.0

WriteCharacteristicOptions

Prop Type Description Default Since
characteristicId string The UUID of the characteristic to write. 6.0.0
deviceId string The address of the device to write the characteristic to. 6.0.0
serviceId string The UUID of the service to write the characteristic to. 6.0.0
timeout number The timeout for the write operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 5000 6.0.0
type 'default' | 'withoutResponse' The type of write operation. 'default' 6.1.0
value number[] The value bytes to write to the characteristic. 6.0.0

WriteDescriptorOptions

Prop Type Description Default Since
characteristicId string The UUID of the characteristic that the descriptor belongs to. 6.0.0
descriptorId string The UUID of the descriptor. 6.0.0
deviceId string The address of the device that the descriptor belongs to. 6.0.0
serviceId string The UUID of the service that the descriptor belongs to. 6.0.0
timeout number The timeout for the write operation in milliseconds. If the operation takes longer than this value, the promise will be rejected. 5000 6.0.0
value number[] The value bytes of the descriptor. 6.0.0

PermissionStatus

Prop Type Description Since
bluetooth PermissionState Permission state for using bluetooth. Only available on iOS. 6.0.0
bluetoothConnect PermissionState Permission state for connecting to a BLE device. Only available on Android. 6.0.0
bluetoothScan PermissionState Permission state for scanning for BLE devices. Only available on Android. 6.0.0
location PermissionState Permission state for using location services. Only available on Android. 6.0.0
notifications PermissionState Permission state for using notifications. Only available on Android. 6.0.0

BluetoothLowEnergyPluginPermission

Prop Type
permissions BluetoothLowEnergyPermissionType[]

PluginListenerHandle

Prop Type
remove () => Promise<void>

CharacteristicChangedEvent

Prop Type Description Since
characteristicId string The UUID of the characteristic. 6.0.0
deviceId string The address of the device. 6.0.0
serviceId string The UUID of the service. 6.0.0
value number[] The changed value bytes of the characteristic. 6.0.0

DeviceDisconnectedEvent

Prop Type Description Since
deviceId string The address of the disconnected device. 6.0.0
name string The name of the disconnected device. 6.0.0

DeviceScannedEvent

Prop Type Description Since
id string The address of the scanned device. 6.0.0
name string The name of the scanned device. 6.0.0
rssi number The RSSI value of the scanned device. Only available on iOS. 6.0.0

Type Aliases

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'

BluetoothLowEnergyPermissionType

'bluetooth' | 'bluetoothConnect' | 'bluetoothScan' | 'location' | 'notifications'

Enums

ConnectionPriority

Members Value Description Since
BALANCED 0 Balanced connection priority. 6.0.0
HIGH 1 High connection priority. 6.0.0
LOW_POWER 2 Low power connection priority. 6.0.0
PRIORITY_DCK 3 Digital Car Key connection priority. 6.0.0

Utils

See docs/utils/README.md.

Changelog

See CHANGELOG.md.

License

See LICENSE.