定位服务关闭时,后台无法扫描蓝牙
2019-07-30 本文已影响0人
冰珊孤雪
Cannot start unfiltered scan in location-off. This scan will be resumed when location is on: 5
搜索蓝牙接口:
/android/platform/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/ScanManager.java
void handleStartScan(ScanClient client) {
...
final boolean locationEnabled = mLocationManager.isLocationEnabled();
if (!locationEnabled && !isFiltered) {
Log.i(TAG, "Cannot start unfiltered scan in location-off. This scan will be"
+ " resumed when location is on: " + client.scannerId);
mSuspendedScanClients.add(client);
if (client.stats != null) {
client.stats.recordScanSuspend(client.scannerId);
}
return;
}
...
}