android-ble-made-easy icon indicating copy to clipboard operation
android-ble-made-easy copied to clipboard

Duplicate Location Service Enabling Prompt on Android 12 Device

Open NoelChew opened this issue 2 years ago • 2 comments

Prompt to enable location service is shown twice on Android 12 devices. Clicking "OK" twice will cause app to crash.

Steps to reproduce crash:

  1. Disable device Location Service
  2. Disable Bluetooth
  3. Kill app
  4. Start app
  5. Enable Bluetooth
  6. Click "OK" to enable Location Service
  7. 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

NoelChew avatar Nov 05 '22 04:11 NoelChew

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().

NoelChew avatar Nov 05 '22 05:11 NoelChew

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.

LeandroSQ avatar Nov 09 '22 01:11 LeandroSQ

Fixed on v1.8.0

LeandroSQ avatar Dec 22 '22 23:12 LeandroSQ