我的目标是了解AltBeacon是如何工作的,并获得关于功耗和信标检测的最有效应用。目前,我正在分析图书馆,我需要一些澄清。
环境:
1/s。Android 10操作系统backgroundMode进行的。以下是我的问题:
RegionBootstrap),我们从两个点到达ScanJobScheduler- `BeaconManager:startMonitoringBeaconsInRegion`: schedules an immediate ScanJob to run in `50 millis`
- `BeaconManager:setBackgroundMode`: cancels the previous scheduled immediate ScanJob (because we are in background mode) and schedules a periodic ScanJob是因为第二个电话不到50 millis而立即取消ScanJob的原因吗?为什么周期ScanJob被排定两次?
- I've seen that the HW filter is installed after ScanJob Lifecycle is completed (`createScanFiltersForBeaconParsers`)
- In the case where the application is killed, this means that the filter will be installed after the 1st periodic ScanJob completes (25 minutes)我们可以在初始化后立即安装低功耗HW过滤器,而不是等待第一个ScanJob完成吗?
- Start service in foreground
- Install HW filter (if point 3 is not an option, do an immediate scan in foreground to trigger it)
- Scan in background until the HW filter delivers the intent
- Start scanning in foreground after we detect the 1st beacon
- Scan in foreground until we are out of the region in order for the HW filter to be installed again (`startPassiveScanIfNeeded`)
- Switch to scanning in background and wait for the next wake-up
BluetoothLEScanner接收意图?谢谢,弗拉德
发布于 2020-05-06 17:07:55
以下是几个答案:
BeaconManager:startMonitoringBeaconsInRegion和BeaconManager:setBackgroundMode都触发了一个“重新调度”进程。您可以通过在您的init过程的早期先调用BeaconManager:setBackgroundMode:来避免这一切。这样,当您调用BeaconManager:startMonitoringBeaconsInRegion时,库已经处于后台模式,并且工作将更加顺利。https://stackoverflow.com/questions/61632067
复制相似问题