Issue
Yo, I have an app that connects to Bluetooth devices (we specify the MAC address). It targets API 28 and Compile SDK is 31.
This is all working fine however I just got a Pixel 6 Pro and the app crashes anytime I try to do anything Bluetooth related. The crash says: Need android.permission.BLUETOOTH_CONNECT permission
The app already has this permission in the Manifest. I can fix the crash but I have to go into the app permissions and allow permission for Nearby devices.
Is there something I have to do to get this working without having to explicitly allow the permission? On API 28 preferably too. I tried what was in the Google Dev docs but seems to still crash. I never had to allow this at runtime previously, is this required now on Android 12? Thanks
Solution
According to Google developer docs you have to ask for permission at runtime, see this article for reference.
Every time you want to perform an action that may be guarded by a permission, ask the user for permission, even if it was previously granted.
Answered By - Christian Kruse
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.