在不征求用户许可的情况下开启 Android LE 扫描
Turn on Android LE scanning without asking user for permission
一些调查和分析表明,用户经常拒绝出现在移动应用程序中的位置权限请求,即使此权限对应用程序至关重要,例如该应用程序会自动扫描场地中处理业务逻辑并与移动应用程序交换数据的设备。许可请求拒绝率如此之高,以至于对业务造成了问题。 Android 中有什么方法可以避免这种情况,例如声明一些无需许可请求即可扫描的已验证设备?我想到了 https://developer.android.com/guide/topics/connectivity/companion-device-pairing 但这也意味着弹出用户手动工作的请求。今天有没有办法在幕后做?
遗憾的是,出于隐私和安全原因,这是不可能的。在 Android 台设备上启用 BLE 与位置权限密切相关。唯一可能的解决方法是使用经典蓝牙而不是 BLE。我不是 100% 确定这个,但在 this article:-
中提到了它
No one can use BLE scan API without having Location Permissions, and,
on most devices, it is useless without active Location Services.
However, Bluetooth Low Energy is an extension to so-called Bluetooth
Classic and interestingly enough Google decided this API does not need
location permissions to be called.
这是无法克服的 OS 要求。您可能已经在 Android developer page for BLE 上看到了这个:-
In order to use Bluetooth features in your application, you must
declare two permissions. The first of these is BLUETOOTH. You need
this permission to perform any Bluetooth communication, such as
requesting a connection, accepting a connection, and transferring
data.
The other permission that you must declare is ACCESS_FINE_LOCATION.
Your app needs this permission because a Bluetooth scan can be used to
gather information about the location of the user. This information
may come from the user's own devices, as well as Bluetooth beacons in
use at locations such as shops and transit facilities.
您可以在此处找到更多相关信息:-
- The Ultimate Guide to Android BLE Development
- Location needs to be enabled for BLE on Android
- Bluetooth versus Location Permission
一些调查和分析表明,用户经常拒绝出现在移动应用程序中的位置权限请求,即使此权限对应用程序至关重要,例如该应用程序会自动扫描场地中处理业务逻辑并与移动应用程序交换数据的设备。许可请求拒绝率如此之高,以至于对业务造成了问题。 Android 中有什么方法可以避免这种情况,例如声明一些无需许可请求即可扫描的已验证设备?我想到了 https://developer.android.com/guide/topics/connectivity/companion-device-pairing 但这也意味着弹出用户手动工作的请求。今天有没有办法在幕后做?
遗憾的是,出于隐私和安全原因,这是不可能的。在 Android 台设备上启用 BLE 与位置权限密切相关。唯一可能的解决方法是使用经典蓝牙而不是 BLE。我不是 100% 确定这个,但在 this article:-
中提到了它No one can use BLE scan API without having Location Permissions, and, on most devices, it is useless without active Location Services. However, Bluetooth Low Energy is an extension to so-called Bluetooth Classic and interestingly enough Google decided this API does not need location permissions to be called.
这是无法克服的 OS 要求。您可能已经在 Android developer page for BLE 上看到了这个:-
In order to use Bluetooth features in your application, you must declare two permissions. The first of these is BLUETOOTH. You need this permission to perform any Bluetooth communication, such as requesting a connection, accepting a connection, and transferring data.
The other permission that you must declare is ACCESS_FINE_LOCATION. Your app needs this permission because a Bluetooth scan can be used to gather information about the location of the user. This information may come from the user's own devices, as well as Bluetooth beacons in use at locations such as shops and transit facilities.
您可以在此处找到更多相关信息:-
- The Ultimate Guide to Android BLE Development
- Location needs to be enabled for BLE on Android
- Bluetooth versus Location Permission