web-bluetooth

Can you manipulate web bluetooth chooser that shows after calling requestDevice()?


Can you manipulate web bluetooth chooser that shows after calling requestDevice()? Like getting the error message or the text displayed?


Solution

  • The chooser can only be manipulated by configuring the filter which controls which devices are shown to the user. The chooser serves as a security and privacy barrier, preventing a site from learning about the devices in the user's vicinity without their explicit permission. The one additional signal which is provided and may be useful for your application is navigator.bluetooth.getAvailability(). This method returns whether the user's device is capable of connecting to Bluetooth devices, but not whether the Bluetooth capability is turned on or there are any devices nearby. If the device is capable of connecting to Bluetooth devices but the adapter is disabled then the browser will guide the user through enabling it as part of the chooser prompt.