-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Supporting Android 12 Bluetooth permissions. #940
base: master
Are you sure you want to change the base?
Conversation
@espresso3389 From the current experience, I advise you not to use compileSdkVersion 31 until flutter move packages to 31 as default. version 30 is backward compatible, so I don't see a reason to upgrade to 31. |
@boskokg Yes, I understand what you're saying. But certain features I'm using on my app force me to upgrade the SDK to 31 now... |
I understand. But you should also understand that other plugins are not updates and this plugin should not block others that must use other plugins and there is no intentions to upgrate compile version soon, until flutter do that on their plugins. |
@espresso3389 perhaps you can link a fork to this with your changes as it seems the repo is no longer maintained? |
@espresso3389 @boskokg running I also have
|
@ekuleshov |
@espresso3389 thank you for looking into this I'm basically doing this:
I'm running on Android 12 and on a first run of the app I see the system permission request dialog and the app shows a "nearby devices" permission allowed after that. I just tried to remove that permission from the app. So, the app stopped failing after that and scan obviously returned nothing and no permission request been brought up on the scan attempts. But once I gave "nearby devices" permission back to the app all seem to be working. No crashes and scan works. Now I'm puzzled if that has something to do with the old Bluetooth permissions that app had. |
@ekuleshov Can you provide me with the complete sample that causes the issue? |
@espresso3389 Hello, using your solution I get interesting behavior. On Android 11, the application asks for permission for the location, I give it to him, but the scan does not find the device until the location is turned on. On Android 9 and Android 10 everything works fine, can you tell me what could be the reason for this behavior ? |
So what is the status for android 12 ? Still not merged ? Do we have to use flutter_blue_plus ? Do we need to use min sdk 31 ? |
I was facing the same problem, but when I used flutter_blue_plus, it shows me the devices near me, |
For #864, I've added codes to handle certain API calls. I'm not sure whether it is fully handle all the calls but at least the example code works correctly.
There are also some problem on declaring permission on AndroidManifest.xml:
The
android.permission.BLUETOOTH_SCAN
hasandroid:usesPermissionFlags="neverForLocation"
but I'm not sure whether all the applications should use the flag. But, without the flag, scanning does not work correctly...