@capgo/capacitor-bluetooth-low-energy
Capacitor Bluetooth Low Energy Plugin for BLE communication.
Overview
Section titled “Overview”Capacitor Bluetooth Low Energy Plugin for BLE communication.
Core Capabilities
Section titled “Core Capabilities”initialize- Initialize the BLE plugin. Must be called before any other method.shimWebBluetooth- Install the Capacitor Web Bluetooth shim onnavigator.bluetooth. Call this manually before using the Web Bluetooth API from a Capacitor native app.isAvailable- Check if Bluetooth is available on the device.isEnabled- Check if Bluetooth is enabled on the device.
Public API
Section titled “Public API”| Method | Description |
|---|---|
initialize | Initialize the BLE plugin. Must be called before any other method. |
shimWebBluetooth | Install the Capacitor Web Bluetooth shim on navigator.bluetooth. Call this manually before using the Web Bluetooth API from a Capacitor native app. |
isAvailable | Check if Bluetooth is available on the device. |
isEnabled | Check if Bluetooth is enabled on the device. |
isLocationEnabled | Check if location services are enabled (Android only). |
openAppSettings | Open the app settings page. |
openBluetoothSettings | Open the Bluetooth settings page (Android only). |
openLocationSettings | Open the location settings page (Android only). |
checkPermissions | Check the current permission status. |
requestPermissions | Request Bluetooth permissions. |
startScan | Start scanning for BLE devices. |
stopScan | Stop scanning for BLE devices. |
connect | Connect to a BLE device. |
disconnect | Disconnect from a BLE device. |
createBond | Create a bond with a BLE device (Android only). |
isBonded | Check if a device is bonded (Android only). |
discoverServices | Discover services on a connected device. |
getServices | Get discovered services for a device. |
getConnectedDevices | Get a list of connected devices. |
readCharacteristic | Read a characteristic value. |
writeCharacteristic | Write a value to a characteristic. |
startCharacteristicNotifications | Start notifications for a characteristic. |
stopCharacteristicNotifications | Stop notifications for a characteristic. |
readDescriptor | Read a descriptor value. |
writeDescriptor | Write a value to a descriptor. |
readRssi | Read the RSSI (signal strength) of a connected device. |
requestMtu | Request MTU size change (Android only). |
requestConnectionPriority | Request connection priority (Android only). |
startAdvertising | Start advertising as a peripheral (BLE server). |
stopAdvertising | Stop advertising. |
startForegroundService | Start a foreground service to maintain BLE connections in background (Android only). |
stopForegroundService | Stop the foreground service (Android only). |
getPluginVersion | Get the native Capacitor plugin version. |
addListener | Add a listener for device scanned events. |
addListener | Add a listener for device connected events. |
addListener | Add a listener for device disconnected events. |
addListener | Add a listener for characteristic changed events. |
removeAllListeners | Remove all listeners for this plugin. |
Source Of Truth
Section titled “Source Of Truth”This reference is synced from src/definitions.ts in capacitor-bluetooth-low-energy.