Good day: D Please scanBleDevices me why the error " LOCATION_PERMISSION_MISSING " may occur when calling the scanBleDevices method? It’s been an hour that I’m puzzling over what I can't think of.

Code snippet:

 import com.polidea.rxandroidble.RxBleClient; import com.polidea.rxandroidble.RxBleScanResult; import rx.Observable; /** * Created by johny on 02.01.2017. */ public class bluetooth_controler { public void rxScan(RxBleClient client){ Observable<RxBleScanResult> scanSubscription = client.scanBleDevices(); } } 

PS In Google carefully searched, empty.

PSS Tried to add <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> to the manifest

  • And what about the dock to the lib on this account said? But not on the 6th axis test with unsolicited permissions in runtime? - Yuriy SPb
  • YuriySPb, in the dock stupidly indicated stubs of examples and without any explanation ( polidea.com/blog/… ) and yes I am testing on the six - alex-rudenkiy

2 answers 2

The fact is that scanning surrounding devices can give information about the location of the device. Therefore, starting with Android 6.0 (API level 23), you need to request android.permission.ACCESS_FINE_LOCATION or android.permission.ACCESS_COARSE_LOCATION . This applies to both the list of bluetooth devices, and MAC addresses and SSID of WiFi networks.

At the same time, runtime permissions appeared in 6.0: permissions that fall into the dangerous group (dangerous) should not only be specified in AndroidManifest.xml , but also explicitly requested from the user. Access to the location is one of them. Read more about this in the documentation .

For experiments at the development stage, you can find yours in Settings in the list of applications, go to the Permissions section, and give your hands permission there.

    According to this thread, gitHube does require location permissions. And she does not check them out of the box. Those. You need, with version 6 of the android, to request them yourself from the user. After he gives permission, you can use the lib itself.

    • What is the relationship between GPS and Bluetooth? 0_o - alex-rudenkiy
    • @ alex-rudenkiy, as far as I understand, some devices have location info and therefore the user should know that some location info will be used - Yuriy SPb