WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

Permission for bluetooth scan

Open ray007 opened this issue 2 years ago • 6 comments

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: image

Additional context I tried settings several Permissions to Allow in the profile, and also set up a PermissionRequested handler, but no luck so far.

AB#45930376

ray007 avatar Jul 28 '23 10:07 ray007

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.

novac42 avatar Jul 31 '23 09:07 novac42

@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!

victorhuangwq avatar Aug 14 '23 22:08 victorhuangwq

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?

ray007 avatar Aug 21 '23 07:08 ray007

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 avatar Aug 30 '23 22:08 victorhuangwq

@victorhuangwq Yes, exactly, I want to create my own UI for showing a list of our sensors to the user.

ray007 avatar Aug 31 '23 08:08 ray007

Nobody else wants Bluetooth scanning?

ray007 avatar Mar 17 '25 11:03 ray007