Why Location permission are required for Ble scan in android Marshmallow onwards

徘徊边缘 提交于 2019-12-03 08:02:22
Larry Schiefer

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!