BLE Permission not working on 0.63.2 with Android 10
See original GitHub issueHello there,
My project was on React Native 0.63.2 version and when I tried to scan ble devices couldn’t see any of them. Even I asking permission and allow the location. It happens only Android 10 devices.
When I check the error callback it says: [BleError: Device is not authorized to use BluetoothLE]
This error not happens on 0.62.2
Interesting things are:
- When I ask permission on Android 10, it’s not ask “Allow Always”, only “Allow While Using” and “Deny”
- When I go to Settings => Apps => <My App> => Permissions => Location section and I select “Deny” and “Allow While Using” again, the error disappears and app can search devices properly.
Buggy versions:
"react": "16.13.1",
"react-native": "0.63.2",
"react-native-ble-plx": "^2.0.1"
Working versions:
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-ble-plx": "^2.0.1"
AndroidManifest.xml permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
It may not happens because of this package, maybe React Native itself but I found it on this package.
Issue Analytics
- State:
- Created 3 years ago
- Comments:16
Top Results From Across the Web
BLE Permission not working on 0.63.2 with Android 10 #730
Hello there,. My project was on React Native 0.63.2 version and when I tried to scan ble devices couldn't see any of them....
Read more >Bluetooth permissions - Android Developers
To use Bluetooth features in your app, you must declare several permissions. You should also specify whether your app requires support for Bluetooth...
Read more >Android 10 not working with BLE Bluetooth scanning
To make BLE scanning work on Android apps targeting Android 10 you need ... Android 10 introduces the ACCESS_BACKGROUND_LOCATION permission.
Read more >react-native-ble-manager - npm
A BLE module for react native.. Latest version: 8.5.0, last published: 20 days ago. Start using react-native-ble-manager in your project by ...
Read more >Android permissions - BLE - Android 12 - MIT App Inventor Help
The BluetoothLE extension has not yet been updated to support Android 12. As a workaround, you can add the BluetoothClient component to your ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
I had the same issue when I updated my targetSdkVersion from 28 to 29.
Replacing the android permission ACCESS_COARSE_LOCATION with ACCESS_FINE_LOCATION in my AndroidManifest.xml and in my app’s code for manually asking the user with PermissionAndroid fixed it for me.
Recap of what’s working for me : build.gradle :
AndroidManifest.xml :
in my app’s code :
Hope this helps.
I struggled with this issue for about 6 hours, nothing worked. Then I restarted my phone and it worked immediately.