I'm trying to get any bluetooth device around myself with my Huawei P30 (Android 10). When I try to use bluetoothAdapter.startDiscovery()
it always returns false. I found out that the problem was the permission ACCESS_COARSE_LOCATION
and ACCESS_FINE_LOCATION
which were not working. So I tried to use every solutions described on this link : Android - Bluetooth discovery doesn't find any device, but unfortunatly, nothing works, the application doesn't start to scan.
Finally, I got the permissions but the function still returns false and the discovery doesn't start... Does any one have a solution for me ?
Asked
Active
Viewed 289 times
0

skyman
- 3
- 2
1 Answers
0
I also had the same problem on an Android 10 Huawei device. Even though I was not using location services in the app. In addition to adding the ACCESS_FINE_LOCATION in the AndroidManifest.xml I also had to
- Grant permission to the app for location.
- Turn on location services in the system settings. Which of course grants always on location access to a bunch of services and apps which can't be disabled within the OS.
It would be good to know if this behaviour is for Android 10 in general or a specific Huawei quirk.

Frost Metoh
- 161
- 1
- 4
-
I've all ready tried that but it still doesn't work... I'm juste stuck on the scanner for Android 10, and if it's not working, my app can not be developped... – skyman Oct 19 '20 at 08:40
-
1I've finnally got it working ! I just didn't check in the Java code if the permission is granted or not, and I didn't asked for it if it's not activated... Thanks for your help ! – skyman Nov 04 '20 at 10:44