flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

Fix android bluetooth permission request above api version 30

Open rufman opened this issue 2 years ago • 2 comments

The BLUETOOTH permission was removed in api version 30 in favor of BLUETOOTH_SCAN, BLUETOOTH_ADVERTISE and BLUETOOTH_CONNECT.

This means that manifests targetting api version above 30 will not have this permission set. For these versions the manifest should be checked for the new permissions.

This change ensures that the documented behavior of the bluetooth permission always returning true is true.

Fixes issues #884

:sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Bug fix for Android api versions above 30 requesting Bluetooth permissions.

:arrow_heading_down: What is the current behavior?

Permission.bluetooth return denied instead of the documented always allowed (https://pub.dev/documentation/permission_handler_platform_interface/latest/permission_handler_platform_interface/Permission/bluetooth-constant.html)

:new: What is the new behavior (if this is a feature change)?

This commit brings the code in line with the documented behavior

:boom: Does this PR introduce a breaking change?

No.

:bug: Recommendations for testing

Test on api versions after 30 with a manifest that only includes one of the new permissions, and either no BLUETOOTH permission, or `<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />

:memo: Links to relevant issues/docs

  • https://pub.dev/documentation/permission_handler_platform_interface/latest/permission_handler_platform_interface/Permission/bluetooth-constant.html
  • https://github.com/Baseflow/flutter-permission-handler/issues/884

:thinking: Checklist before submitting

  • [x] I made sure all projects build.
  • [x] I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • [x] I updated CHANGELOG.md to add a description of the change.
  • [x] I followed the style guide lines (code style guide).
  • [x] I updated the relevant documentation.
  • [x] I rebased onto current master.

rufman avatar Feb 10 '23 20:02 rufman

Is there an update on this? Right now this workaround https://github.com/Baseflow/flutter-permission-handler/issues/884 is not even working anymore, since it throws error Element uses-permission#android.permission.BLUETOOTH at AndroidManifest.xml:6:3-66 duplicated with element declared at AndroidManifest.xml:3:3-5:36

C-8 avatar Jun 21 '23 10:06 C-8

Is there an update on this? Right now this workaround #884 is not even working anymore, since it throws error Element uses-permission#android.permission.BLUETOOTH at AndroidManifest.xml:6:3-66 duplicated with element declared at AndroidManifest.xml:3:3-5:36

I have a test app running on devices with API level 23 and 33 and I don't need any workarounds. I always use the new permissions, it works even on old devices (see my other rather lengthy comment) and the lib implements fallbacks. I think this PR should be closed as it is unnecessary.

wujek-srujek avatar Jul 10 '23 22:07 wujek-srujek

Agreed with @wujek-srujek, closing this PR

mvanbeusekom avatar Aug 16 '24 10:08 mvanbeusekom