Open janusw opened 8 months ago
Btw, the exact same problem also affects Permissions.NearbyWifiDevices
, which can also be used with android:usesPermissionFlags="neverForLocation"
.
The permissions Bluetooth
and NearbyWifiDevices
were introduced with PR #12413 and #14718.
Android documentation references:
YES, I want measurement equipment using bluetooth and smartphone as control device/display never ask for location permission!
Description
Since Android 12, it is possible to do Bluetooth scanning without location permissions. To achieve this, one has to declare the BT scanning permission in the Android manifest like this:
Requesting the permissions at runtime works well for this scenario, as long as
ACCESS_FINE_LOCATION
is not declared in the manifest:However, if
ACCESS_FINE_LOCATION
is declared in the manifest, but is denied at runtime (whileBLUETOOTH_SCAN
is granted), then the snippet above reports the status asPermissionStatus.Denied
.This wrongly signals to the application that scanning is not possible, while in fact it is.
Steps to Reproduce
dotnet-bluetooth-le
repository (link below).BLE.Client.MAUI
and run it on a Android 12+ device.Link to public reproduction project repository
https://github.com/dotnet-bluetooth-le/dotnet-bluetooth-le
Version with bug
8.0.7 SR2
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 12 and up
Did you find any workaround?
Ignore the wrong permission status.
Relevant log output
No response