-
-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] Bluetooth permission required twice #884
Comments
Android 12's permission handling has changed, so the I think this should be changed in the documentation of the permission handler, since the documentation is still targeting Android 11 and lower. |
Since my use case is only to check whether bluetooth is turned on or off, I actually don't need any bluetooth permission at all on no android device. The documentation says that the In the end on Android I can safely ignore the Bluetooth permission handling. But regarding the behaviour of the library it's still strange, that there is that error message. <uses-permission android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/> it still shows me this error message: I updated the example repo with this for you to check. |
I've encountered a similar problem, but with bluetooth AND location. After duplicating the Permissions:
Request code:
Android 12 Flutter 3.3.0-0.2.pre • channel beta • https://github.com/flutter/flutter.git |
I've been struggling the the exact same issue with |
@benjaminpaik, if I remember correctly there were issues with release builds when having the permission set twice in the manifest. So that is not really a workaround. |
In my case I got same error before flutter 3.7.0. |
@appano1 Hmm. I just tried upgrading to flutter 3.7.0 as well and I still have permission issues. |
@benjaminpaik Try this..! flutter: 3.7.0 AndroidManifest.xml <uses-permission android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<!-- Bluetooth permission for Android sdk version > 30 -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> in your dart file // If the Android version is higher than 30,
await [
Permission.bluetoothConnect,
Permission.bluetoothScan,
Permission.bluetoothAdvertise,
].request(); |
@appano1 Thanks for replying. That's basically how I have it, but it still only works if I add BLUETOOTH permissions twice. |
Duplicating the My working merged
I suspect that |
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 Baseflow#884
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 Baseflow#884
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 Baseflow#884
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 Baseflow#884
This might help https://www.youtube.com/watch?v=uMvGpBOT0ZY |
Adding bluetooth permission twice is not working anymore. It throws error: |
Any update on this issue? |
@C-8 any workaround on this? |
I just tested my old project upgrading to Flutter 3.16.3 and permission_handler 11.1.0. Adding BLUETOOTH to the manifest twice still works for me. Perhaps it was broken and then fixed in a recent update. |
🐛 Bug Report
I only want to test whether Bluetooth is turned on or off (with
flutter_blue_plus
), therefore I would assume that only<uses-permission android:name="android.permission.BLUETOOTH"/>
would be sufficient.However, when I request Bluetooth permission I get
D/permissions_handler(27550): Bluetooth permission missing in manifest
.The same is true when there is no
uses-permission
entry at all.Setting the line twice like this however works:
This only happens in combination with
flutter_blue_plus
, but since the error message is reported by this plugin I wanted to start here.I actually can request the bluetooth state even without the permission at all on my device (android 12) but I guess it's necessary on older devices.
The problem with adding the permission twice is that Google Play refuses to accept the AABs.
Expected behaviour
Requesting/getting the permission result without error messages.
Reproduction steps
I created a small reproducing project here.
In the
AndroidManifest.xml
the Bluetooth permission is only added once, which leads to the error above.Configuration
Phone: Pixel 5 with Android 12
Version: 10.0.0
Platform:
The text was updated successfully, but these errors were encountered: