0

即使在设置扫描间隔之后我也遇到了同样的问题 didExitRegion 永远不会被调用。我在 Android 上使用 eddystone google 信标,并且在 android 服务中运行信标扫描功能。我的信标代码如下:

Beacon initialization

mBeaconManager = BeaconManager.getInstanceForApplication(this.getApplicationContext());
// Detect the main Eddystone-UID frame:
mBeaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("s:0-1=feaa,m:2-2=10,p:3-3:-41,i:4-21v"));
mBeaconManager.setBackgroundScanPeriod(1000l);
mBeaconManager.setBackgroundBetweenScanPeriod(3000l);
mBeaconManager.bind(this);

didEnterRegion

url = UrlBeaconUrlCompressor.uncompress(region.getId1().toByteArray());
Log.d("radbeacon", "Beacon detected with namespace id " + region.getId1() + " and instance id: " + url);

didExitRegion

url = UrlBeaconUrlCompressor.uncompress(region.getId1().toByteArray());
Log.d("radbeacon", "Beacon out of region with namespace id " + region.getId1() + " and instance id: " + url);
4

0 回答 0