如果使用的是 org.altbeacon:android-beacon-library:2.17.1 出现了三星设备再关闭屏幕后 didRangeBeaconsInRegion();返回的 beacons.size 等于 0
https://github.com/AltBeacon/android-beacon-library/issues/933
解决办法:
beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().clear();
int[] hardwareAssistManufacturers =new int[]{0x01QP};// add dock Manufacturer Data.
‘0x01QP’是硬件设备蓝牙的Manufacturer Data. 需要设置这个过滤条件,否则锁屏后三星设备将无法callback BLE broadcast.
BeaconParser beaconParser =new BeaconParser().setBeaconLayout(Collocation.IBEACON_LAYOUT);
beaconParser.setHardwareAssistManufacturerCodes(hardwareAssistManufacturers);
beaconManager.getBeaconParsers().add(beaconParser);
网友评论