Permission for bluetooth scan
Description I know it's an experimental feature which needs to be enabled with
new CoreWebView2EnvironmentOptions("--enable-experimental-web-platform-features");
, but I'd still give out the permission from the code instead of having the user allow it in the dialog.
Version SDK: 1.0.1901.177 Runtime: 115.0.1901.183 Framework: WPF, but others probably too OS: Win10
Regression Not a regression since it's an experimental feature.
Repro Steps After enabling the experimental web platform features, execute a javascript call
btScan = await navigator.bluetooth.requestLEScan(options);
Screenshots
The dialog shown that I'm trying to avoid is this:
Additional context
I tried settings several Permissions to Allow in the profile, and also set up a PermissionRequested handler, but no luck so far.
Thanks for reporting the issue and sorry you are running into it. I've assigned this to a dev who can help follow up on this.
@ray007 Hi ray, can I further understand the following:
- The context of the app that you are working on
- The specific scenario that you are trying to achieve. I.e. Why would you like to do bluetooth scan without the dialog?
Thank you!
Not sure why the context matters, but all right: our company sells bluetooth sensors, which also provide data (urls) via bluetooth for use with the building management system. Sensor data is already used by our mobile app, and we would also like to use it in our windows app, so people with laptops can easier connect to the correct views in the bms for the room they're sitting in.
The permission dialog showed a quite ugly list, after which getting scan advertisements didn't always work. Which may also be the fault of my usb bluetooth adapter. But I'd like to show my own styled list for sensors (like I do in our mobile app), or in some cases even automatically connect to the "best".
Independent of context: shouldn't all permissions/dialogs be in the API?
Just to make sure I understand, you would like an API that you can use to create the bluetooth scan UI by yourself? If so, I can understand why you would need an API that allows you to control the underlying functionality of the dialog
Independent of context: shouldn't all permissions/dialogs be in the API?
All Web APIs, like the Web Bluetooth API, are available for you to use. But that triggers the default web dialog, like how it would in Chromium browsers.
For situations where a developer, like yourself, want to bypass the typical browser permission dialogs, we would need to create specific APIs that allow developers to do that.
This issue is already tracked (as per the tag).
@victorhuangwq Yes, exactly, I want to create my own UI for showing a list of our sensors to the user.
Nobody else wants Bluetooth scanning?