我知道关于altbeacon库存在很多问题,尤其是当它在后台运行时。但是,我找不到任何正在讨论的相同问题,因此我要提出一个新问题。
在我的android 7.1.1设备上,我正在使用版本2.7.0的altbeacon库的Xamarin绑定。当应用程序处于后台且手机未锁定时,应用程序将在配置的时间间隔后开始扫描,并找到正确的信标。但是,当手机锁定后,该应用程序将立即停止获取任何扫描结果。此外,altbeacon调试消息表明,当手机被锁定时,该库开始扫描,但是从未找到扫描结果。
该应用具有位置权限。
该问题可能源于altbeacon库的旧版本。另外,日志显示starting non-filtered scan in SCAN_MODE_LOW_LATENCY
,扫描是否未过滤可能有问题吗?
请查看以下日志:
应用在后台运行但手机未锁定:
[CycledLeScannerForLollipop] Waiting to start full Bluetooth scan for another 1106 milliseconds
[CycledLeScannerForLollipop] Waiting to start full Bluetooth scan for another 103 milliseconds
[CycledLeScanner] starting a new scan cycle
[CycledLeScanner] starting a new bluetooth le scan
[CycledLeScannerForLollipop] starting non-filtered scan in SCAN_MODE_LOW_LATENCY
[BluetoothAdapter] STATE_ON
[BluetoothLeScanner] onClientRegistered() - status=0 clientIf=10 mClientIf=0
[CycledLeScanner] Waiting to stop scan cycle for another 60000 milliseconds
[CycledLeScanner] Set a wakeup alarm to go off in 300000 ms: PendingIntent{8c4a54e: android.os.BinderProxy@e6c566f}
[CycledLeScanner] Scan started
[CycledLeScannerForLollipop] got record
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
...
然后当我锁定手机时:
[CycledLeScanner] Waiting to stop scan cycle for another 48903 milliseconds
[CycledLeScanner] Set a wakeup alarm to go off in 300000 ms: PendingIntent{8c4a54e: android.os.BinderProxy@e6c566f}
[CycledLeScannerForLollipop] got record
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Processing pdu type FF: 0201021aff4c0002156c2e3172768b4d3ea47b01470fe908a40000019bc80000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 29
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 0201021aff4c0002156c2e3172768b4d3ea47b01470fe908a40000019bc80000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Processing pdu type FF: 0201021aff4c0002156c2e3172768b4d3ea47b01470fe908a40000019bc80000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 29
[BeaconParser] This is a recognized beacon advertisement -- 02 15 seen
[BeaconService] beacon detected : id1: 6c2e3172-768b-4d3e-a47b-01470fe908a4 id2: 0 id3: 411
[BeaconService] This region (id1: 31c668d3-6b81-4be2-876c-228ed4f88df8 id2: 0 id3: 411) does not match beacon: id1: 6c2e3172-768b-4d3e-a47b-01470fe908a4 id2: 0 id3: 411
[BeaconService] looking for ranging region matches for this beacon
[CycledLeScannerForLollipop] got record
[CycledLeScannerForLollipop] got record
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Processing pdu type FF: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Processing pdu type FF: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[CycledLeScannerForLollipop] got record
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[CycledLeScannerForLollipop] got record
[CycledLeScannerForLollipop] with service uuid: 0000fe61-0000-1000-8000-00805f9b34fb
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Ignoring pdu type 08
[BeaconParser] Ignoring pdu type 03
[BeaconParser] Processing pdu type FF: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000 with startIndex: 12, endIndex: 26
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Ignoring pdu type 08
[BeaconParser] Ignoring pdu type 03
[BeaconParser] Processing pdu type FF: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000 with startIndex: 12, endIndex: 26
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000
[CycledLeScannerForLollipop] got record
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[CycledLeScannerForLollipop] got record
[CycledLeScannerForLollipop] with service uuid: 0000fe61-0000-1000-8000-00805f9b34fb
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Ignoring pdu type 08
[BeaconParser] Ignoring pdu type 03
[BeaconParser] Processing pdu type FF: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000 with startIndex: 12, endIndex: 26
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Ignoring pdu type 08
[BeaconParser] Ignoring pdu type 03
[BeaconParser] Processing pdu type FF: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000 with startIndex: 12, endIndex: 26
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000
[CycledLeScannerForLollipop] got record
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Processing pdu type FF: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Processing pdu type FF: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[CycledLeScannerForLollipop] got record
[CycledLeScannerForLollipop] with service uuid: 0000fe61-0000-1000-8000-00805f9b34fb
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Ignoring pdu type 08
[BeaconParser] Ignoring pdu type 03
[BeaconParser] Processing pdu type FF: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000 with startIndex: 12, endIndex: 26
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Ignoring pdu type 08
[BeaconParser] Ignoring pdu type 03
[BeaconParser] Processing pdu type FF: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000 with startIndex: 12, endIndex: 26
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000
[CycledLeScannerForLollipop] got record
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[CycledLeScannerForLollipop] got record
[CycledLeScannerForLollipop] with service uuid: 00001802-0000-1000-8000-00805f9b34fb
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Ignoring pdu type 09
[BeaconParser] Processing pdu type 16: 020102100948617070696d65746572204b525244041602184103020218000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 22, endIndex: 24
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 020102100948617070696d65746572204b525244041602184103020218000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Ignoring pdu type 09
[BeaconParser] Processing pdu type 16: 020102100948617070696d65746572204b525244041602184103020218000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 22, endIndex: 24
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 020102100948617070696d65746572204b525244041602184103020218000000000000000000000000000000000000000000000000000000000000000000
[CycledLeScannerForLollipop] got record
[CycledLeScannerForLollipop] with service uuid: 0000fe61-0000-1000-8000-00805f9b34fb
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Ignoring pdu type 08
[BeaconParser] Ignoring pdu type 03
[BeaconParser] Processing pdu type FF: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000 with startIndex: 12, endIndex: 26
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Ignoring pdu type 08
[BeaconParser] Ignoring pdu type 03
[BeaconParser] Processing pdu type FF: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000 with startIndex: 12, endIndex: 26
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 020106020800030361fe10ff030000601d00000444032cc4de291216ff030000601d00000444032cc4de2988c626820af412000000000000000000000000
[CycledLeScannerForLollipop] got record
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Processing pdu type FF: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Processing pdu type FF: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 02011a0aff4c00100503103782db000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[CycledLeScannerForLollipop] got record
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[CycledLeScannerForLollipop] got record
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[CycledLeScannerForLollipop] got record
[BeaconParser] Ignoring pdu type 01
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Processing pdu type FF: 02011a1aff4c000c0e088fbb195d19bf24efde97ca7c7310050b10004a980000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 29
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 02011a1aff4c000c0e088fbb195d19bf24efde97ca7c7310050b10004a980000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] Processing pdu type FF: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 22
[BeaconParser] Ignoring pdu type 01
[BeaconParser] Processing pdu type FF: 02011a1aff4c000c0e088fbb195d19bf24efde97ca7c7310050b10004a980000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 29
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 02011a1aff4c000c0e088fbb195d19bf24efde97ca7c7310050b10004a980000000000000000000000000000000000000000000000000000000000000000
[BeaconParser] This is not a matching Beacon advertisement. (Was expecting 02 15. The bytes I see are: 16ff06000109210a2c1b17cda8a04d6f6e696b612d5043000000000000000000000000000000000000000000000000000000000000000000000000000000
[CycledLeScanner] Waiting to stop scan cycle for another 47897 milliseconds
[CycledLeScanner] Set a wakeup alarm to go off in 300000 ms: PendingIntent{8c4a54e: android.os.BinderProxy@e6c566f}
[CycledLeScanner] Waiting to stop scan cycle for another 46890 milliseconds
[CycledLeScanner] Set a wakeup alarm to go off in 300000 ms: PendingIntent{8c4a54e: android.os.BinderProxy@e6c566f}
[CycledLeScanner] Waiting to stop scan cycle for another 45880 milliseconds
[CycledLeScanner] Set a wakeup alarm to go off in 300000 ms: PendingIntent{8c4a54e: android.os.BinderProxy@e6c566f}
[CycledLeScanner] Waiting to stop scan cycle for another 44875 milliseconds
[CycledLeScanner] Set a wakeup alarm to go off in 300000 ms: PendingIntent{8c4a54e: android.os.BinderProxy@e6c566f}
[CycledLeScanner] Waiting to stop scan cycle for another 43865 milliseconds
[CycledLeScanner] Set a wakeup alarm to go off in 300000 ms: PendingIntent{8c4a54e: android.os.BinderProxy@e6c566f}