LE gatt 第三方应用无法搜索到蓝牙低功耗设备
来源:互联网 发布:unity3d销毁物体 编辑:程序博客网 时间:2024/05/21 17:17
手机端修改packages/apps/Bluetooth/res/values/config.xml文件中strict_location_check的值由true改为false,用户
在进行扫描LE设备时则可以返回给APP。从而不需要用户强制打开GPS。
packages/apps/Bluetooth/src/com/android/bluetooth/gatt/GattService.java
/** Determines if the given scan client has the appropriate permissions to receive callbacks. */
private boolean hasScanResultPermission(final ScanClient client) {
final boolean requiresLocationEnabled =
getResources().getBoolean(R.bool.strict_location_check);
final boolean locationEnabledSetting = Settings.Secure.getInt(getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF)
!= Settings.Secure.LOCATION_MODE_OFF;
final boolean locationEnabled = !requiresLocationEnabled || locationEnabledSetting
|| client.legacyForegroundApp;
return (client.hasPeersMacAddressPermission
|| (client.hasLocationPermission && locationEnabled));
}
在进行扫描LE设备时则可以返回给APP。从而不需要用户强制打开GPS。
packages/apps/Bluetooth/src/com/android/bluetooth/gatt/GattService.java
/** Determines if the given scan client has the appropriate permissions to receive callbacks. */
private boolean hasScanResultPermission(final ScanClient client) {
final boolean requiresLocationEnabled =
getResources().getBoolean(R.bool.strict_location_check);
final boolean locationEnabledSetting = Settings.Secure.getInt(getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF)
!= Settings.Secure.LOCATION_MODE_OFF;
final boolean locationEnabled = !requiresLocationEnabled || locationEnabledSetting
|| client.legacyForegroundApp;
return (client.hasPeersMacAddressPermission
|| (client.hasLocationPermission && locationEnabled));
}
阅读全文
1 0
- LE gatt 第三方应用无法搜索到蓝牙低功耗设备
- Bluetooth LE(低功耗蓝牙) - 第三部分
- Bluetooth LE(低功耗蓝牙) - 第三部分
- 蓝牙低功耗profile:ATT和GATT
- Android 蓝牙低功耗Ble Gatt浅谈
- [BLE]低功耗蓝牙之GAP、GATT
- Bluetooth LE(低功耗蓝牙) - 第一部分
- Bluetooth LE(低功耗蓝牙) - 第二部分
- Bluetooth LE(低功耗蓝牙) - 第四部分
- Bluetooth LE(低功耗蓝牙) - 第五部分
- Bluetooth LE(低功耗蓝牙) - 第一部分
- Bluetooth LE(低功耗蓝牙) - 第二部分
- Bluetooth LE(低功耗蓝牙) - 第四部分
- Bluetooth LE(低功耗蓝牙) - 第五部分
- Bluetooth LE(低功耗蓝牙) 系列
- 蓝牙5 低功耗蓝牙LE controller层分析
- 低功耗蓝牙在便携式医疗设备中的应用展望
- 低功耗蓝牙BLE学习篇:低功耗蓝牙以及GATT的概念
- aws 架构
- 第1章-初识Java
- null与undefined的区别
- java代码遍历目录下的所有文件(查找对应目录下的所有文件)
- 文章标题Maven在Eclipse构建web项目
- LE gatt 第三方应用无法搜索到蓝牙低功耗设备
- python隔离虚拟环境拷贝至服务器
- 让你自己编写的Android的Launcher成为系统中第一个启动应用程序
- 四大范围对比
- teamviewer
- ExtJS流程总结(一)
- JS中的继承
- DDD & Microservices
- python rabbitmq 延迟队列