8

With the latest release of Android called Marshmallow,Starting a Bluetooth Low Energy scan requires permission from Location group. As a result of that one of the following permissions are required:

ACCESS_COARSE_LOCATION , ACCESS_FINE_LOCATION

Any reason why we need to switch on GPS for BLE scan?

Jaymin Panchal
  • 2,797
  • 2
  • 27
  • 31
Gaurav Kakkar
  • 91
  • 1
  • 1
  • 3
  • Possible duplicate of [Location needs to be enabled for Bluetooth Low Energy Scanning on Android 6.0](https://stackoverflow.com/questions/33045581/location-needs-to-be-enabled-for-bluetooth-low-energy-scanning-on-android-6-0) – Priyank Mehta Jun 09 '17 at 09:08
  • This question has correct answer on this thread.. https://stackoverflow.com/questions/33045581/location-needs-to-be-enabled-for-bluetooth-low-energy-scanning-on-android-6-0 – Priyank Mehta Jun 09 '17 at 09:08

2 Answers2

10

BLE beacons can be used to get location information using nothing more than the BLE broadcast UUID data and an internet connection (e.g. iBeacon, AltBeacon etc.) Since this is possible and the data can be acquired via scan, a permission for location is required. In reality, ACCESS_COARSE_LOCATION is the required level in order to get NetworkProvider level of permission. By using, ACCESS_FINE_LOCATION you get NetworkProvider as well as GPS.

Dhaval Shah
  • 618
  • 6
  • 15
Larry Schiefer
  • 15,687
  • 2
  • 27
  • 33
3

Bluetooth permissions let you scan beacons in the foreground without location permissions, but for background scanning you will need location permissions turned on. if you are adding this permissions

<uses-permission android:name="android.permission.BLUETOOTH" />  
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

then you will have to use this permission also

 <uses-permission
 android:name="android.permission.ACCESS_COARSE_LOCATION”/>
 <uses-feature android:name="android.hardware.location.gps" />

see developer guide here

TysonSubba
  • 1,362
  • 2
  • 12
  • 16