即使在设置了扫描间隔后,我也遇到了同样的问题,而且永远不会调用didExitRegion。我在Android上使用eddystone google beacon,我在android服务中运行beacon扫描功能。我的信标代码如下:
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);