android-ble-made-easy
android-ble-made-easy copied to clipboard
Duplicate Location Service Enabling Prompt on Android 12 Device
Prompt to enable location service is shown twice on Android 12 devices. Clicking "OK" twice will cause app to crash.
Steps to reproduce crash:
- Disable device Location Service
- Disable Bluetooth
- Kill app
- Start app
- Enable Bluetooth
- Click "OK" to enable Location Service
- Click "OK" to enable Location Service (again)
Logcat:
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=598333496, result=-1, data=Intent { (has extras) }} to activity {quevedo.soares.leandro.blemadeeasy/quevedo.soares.leandro.blemadeeasy.view.MainActivity}: java.lang.IllegalStateException: Already resumed, but proposed with update true
I found out that the ScanDeviceFragment calls onStop() when requesting to enable Bluetooth Adapter for my Android 12 device. This does not happen for my other devices. After selecting "Deny" or "Allow", the fragment will call onStart() again, which includes the call to requestPermission().
Thank you for you finding and contribution!
I've added a comment on your PR, I'm planning on include it and the legacy device fix on the next release, and hopefully get it published by EOW.
Fixed on v1.8.0