question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Device not authorized to use BluetoothLE

See original GitHub issue

Hi, just upgraded to react-native-ble-plx from a different ble module. I’m getting an error when I run startDeviceScan on android 8.0.0, react-native 0.54.4:

Error: Device is not authorized to use BluetoothLE
    at new BleError (BleError.js:53)
    at parseBleError (BleError.js:68)
    at scanListener (BleManager.js:298)
    at RCTDeviceEventEmitter.emit (EventEmitter.js:181)
    at MessageQueue.__callFunction (MessageQueue.js:353)
    at MessageQueue.js:118
    at MessageQueue.__guardSafe (MessageQueue.js:316)
    at MessageQueue.callFunctionReturnFlushedQueue (MessageQueue.js:117)
    at t (RNDebuggerWorker.js:1)

This seems like it would be a permissions problem, but it isn’t.

AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          ...
          xmlns:tools="http://schemas.android.com/tools">
          ...
          <uses-permission android:name="android.permission.BLUETOOTH" />
          <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
          <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
          <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
          <uses-sdk
                  android:minSdkVersion="18"
                  android:targetSdkVersion="23"/>
          ...

The bleManager reports that bluetooth is “PoweredOn” and I’ve verified this directly.

Whats going wrong here?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

100reactions
warrenronsiekcommented, Apr 8, 2018

I checked the app install, and despite the fact that the AndroidManifest.xml requests the correct permissions (and a bunch of other permissions as well), Android’s App Info says “No Permissions Granted”.

I went to Settings > Apps and notifications > App permissions > Location Permissions and my app was turned off for some reason. Turning it on resolved the problem.

Looks like even if you ask for permissions in the manifest, Android might not grant them. Apparently the way you solve this is by using react-native’s PermissionsAndroid and asking in app to get location enabled. I’m closing this issue, but we might want to add something about this in the README.

43reactions
mtrabelsicommented, Oct 20, 2019

You promised to update the README, imagine how we can make the world a better place by writing 1 line in readme to save hundreds if not thousands of hour for humanity 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to use react native Bluetoothel - Stack Overflow
You need to explicitly ask the user for the permission. I had the same problem and I solved it by adding this code...
Read more >
Bluetooth permissions - Android Developers
If your app looks for Bluetooth devices, such as BLE peripherals, declare the BLUETOOTH_SCAN permission. If your app makes the current device discoverable...
Read more >
BluetoothLE Enable ? | Apple Developer Forums
BluetoothLE Enable ? ... I have a project to work with BluetoothLE. ... state = @"The app is not authorized to use Bluetooth...
Read more >
RxBLELibraries/react-native-ble - Gitter
@dariuszseweryn when I disconnects device and connect again, I get this error. BleError: Device F1:02:00:02:50:49 is not connected.
Read more >
iOs and the Exsurgo Performance System
If bluetooth is not allowed, you will see an error "ALERT BleError: Device is not authorized to use BluetoothLE." This means you need...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found