Altbeacon NonBeaconLeScanCallback set setBackgroundScanPeriod?

问题描述 投票:0回答:1

我使用Altbeacon NonBeaconLeScanCallback-> onNonBeaconLeScan()函数来扫描不是ibeacon的蓝牙设备。

@Override
    public void onNonBeaconLeScan(BluetoothDevice bluetoothDevice, int i, byte[] bytes) {
}

是否可以为此方法设置扫描周期?

android bluetooth altbeacon
1个回答
1
投票

该库主要用于信标检测,但其扫描循环也适用于非信标检测。它以可配置的速率安排扫描时间,如下所示:

beaconManager.setForegroundScanPeriod(...)
beaconManager.setForegroundBetweenScanPeriod(...)
beaconManager.setBackgroundScanPeriod(...)
beaconManager.setBackgroundBetweenScanPeriod(...)

参数以毫秒为单位。前景的默认值为1100/0,背景的默认值为10000/300000

请注意,在Android 8+上,除非使用前台服务,否则两次扫描之间的间隔将由操作系统限制为〜15分钟。

© www.soinside.com 2019 - 2024. All rights reserved.