3

Is there a way to auto connect to a paired device with the web Bluetooth ?

So i can get rid of the annoying pop up device selector from google..

Stweet
  • 683
  • 3
  • 11
  • 26

1 Answers1

5

As of this moment, I have implemented navigator.bluetooth.getDevices() behind a flag in Chrome. To use the API, the Experimental Web Platform features flag in chrome://flags needs to be enabled. Please follow Issue 577953: bluetooth: Get permitted devices for updates on getDevices().

For reconnecting to a device, I'm also implementing the watchAdvertisements() API to allow apps to receive an Event when system perceives an advertisement packet from device on which this was called on. Please follow Issue 654897: bluetooth: Implement watchAdvertisements() for updates on this API.

These two are part of a bigger project for implementing persistent permissions for Web Bluetooth to allow sites to reconnect to devices that they already had permission to connect to via the device chooser prompt.

  • These two APIs are now implemented behind the chrome://flags/#enable-experimental-web-platform-features flag. Additionally, the new permissions backend allows permissions to persist until the permission is revoked in Site Settings or the Page Info dialog box. This new backend is implemented behind the chrome://flags/#enable-web-bluetooth-new-permissions-backend.Use `watchAdvertisements()` to scan for the device nearby before connecting to it. Please give these a try and file any bugs at https://crbug.com. – Ovidio Ruiz-Henríquez Jun 22 '20 at 23:17
  • 1
    One more clarification, these APIs are available in Chrome 85.0.4165.0 or higher. So currently Chrome Canary and Chrome Dev channels. – Ovidio Ruiz-Henríquez Jun 22 '20 at 23:53
  • 2
    Can we autoconnect the already paired device, now...! I hope to get a stable api for auto-connection. – UGandhi May 09 '22 at 10:11