Xamarin Android中使用Alt-beacon库扫描iBeacons被过滤问题
问题:iBeacon扫描被Android位置拒绝列表过滤的排查
环境说明
- 基于Xamarin Forms开发应用,通过依赖服务实现beacon监控,包含
MonitorNotifier和RangeNotifier逻辑 - 使用2.19.4版本的Alt-beacon库搜索iBeacon,已创建Xamarin绑定库并补充部分类完成编译
- 应用已向用户申请蓝牙权限(
BLUETOOTH_SCAN、BLUETOOTH_CONNECT、BLUETOOTH_ADMIN)及运行时位置权限(ACCESS_FINE_LOCATION、ACCESS_BACKGROUND_LOCATION) - AndroidManifest.xml中未设置蓝牙权限的
neverForLocation属性,应用及绑定库的目标Android版本均为13
异常日志
扫描时出现被位置拒绝列表过滤的日志:
07-13 18:27:50.990 V/BtGatt.GattService( 4285): Skipping data matching denylist: ScanRecord [mAdvertiseFlags=6, mServiceUuids=[0a834234-e4a6-4fbd-a596-383e852d706f], mServiceSolicitationUuids=[], mManufacturerSpecificData={76=[2, 21, 111, 112, 45, -123, 62, 56, -106, -91, -67, 79, -90, -28, 52, 66, -125, 10, 0, 0, -33, 126, -59]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=ACS Beacon, mTransportBlocks=[]] 07-13 18:27:50.990 I/BtGatt.GattService( 4285): Skipping client for location deny list ...
Beacon解析代码
当前使用的Beacon解析布局代码如下:
var parser = new BeaconParser(); parser.SetBeaconLayout(Constants.BeaconLayout); parser.SetHardwareAssistManufacturerCodes(new int[]{0x004c}); _beaconManager = BeaconManager.GetInstanceForApplication(Application.Context); _beaconManager.BeaconParsers.Clear(); _beaconManager.BeaconParsers.Add(parser);
其中Constants.BeaconLayout的格式为:m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24
请求
排查该扫描被位置拒绝列表过滤的原因及解决方法。
内容的提问来源于stack exchange,提问作者zyzzyxx
相关产品推荐
相关产品推荐

