'Forget already paired device - web-bluetooth
I am working on web-bluetooth to connect a Web-App with BLE device. I have the connections now, I am looking how can I unpair a device.
I have looked into the official web-bluetooth documents https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-getdevices haven't find much about it.
Can anybody suggest something on this?
Thanks
Solution 1:[1]
What a coincidence! I am currently working on adding a new forget() method on BluetoothDevice so that web developers can revoke permission access to a paired BluetoothDevice.
// Request a Bluetooth device.
const device = await navigator.bluetooth.requestDevice({ acceptAllDevices: true });
// Then later... revoke permission to the Bluetooth device.
await device.forget();
- Spec PR: https://github.com/WebBluetoothCG/web-bluetooth/pull/574
- Chromium CL: https://bugs.chromium.org/p/chromium/issues/detail?id=1302328
Note that this experimental functionality is currently available in Chrome 101 and requires users to enable the chrome://flags/#enable-web-bluetooth-new-permissions-backend flag.
You can try my sample at https://bluetoothdevice-forget.glitch.me/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | François Beaufort |
