Android Question Dealing with BLUETOOTH_SCAN on SDK>30

Creideiki

Active Member
Licensed User
Longtime User
Hi,

I have a app which deals with bt devices. I tried to lift it to sdk >30 and added the new permissions, e.g. BLUETOOTH_SCAN. Everything works fine, but now and then it crashes with an "SecurityException: Need android.permission.BLUETOOTH_SCAN permission". On one crash it tried to call cancelDiscovery in _service_destroy of a service - so I not even had a chance to catch the exception.

I found that I could use the android:usesPermissionFlags="neverForLocation" with this permission. But I don't really understand what this flag would cause (in addition to filtering BLE beacons).

Is there anything I have to do in addition to declaring BLUETOOTH_SCAN?

Thanks
Helmut
 
Top