Библиотека Altbeacon: маяк вихря выходит из области (по-видимому) без причины

У меня есть сигнал маяка с частотой 10 Гц (Eddystone UID, Eddystone TLM и iBeacon) во время движения, когда движение останавливается, оно продолжает передачу еще 1 минуту, а затем останавливается. Моя цель - определить, когда маяк перестает двигаться, поэтому я использовал следующий код, который на самом деле является базовым примером, представленным на веб-странице altbeacon с настроенным временем:

public class BeaconReaderActivity extends Activity implements BeaconConsumer, MonitorNotifier, RangeNotifier {

    private BeaconManager beaconManager;
    private Region beaconRegion;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_beacon_reader);

        beaconManager = BeaconManager.getInstanceForApplication(this);
        beaconManager.getBeaconParsers().add(new BeaconParser()
            .setBeaconLayout(BeaconParser.EDDYSTONE_UID_LAYOUT));
        beaconManager.getBeaconParsers().add(new BeaconParser()
            .setBeaconLayout(BeaconParser.EDDYSTONE_TLM_LAYOUT));
        beaconManager.setRegionStatePeristenceEnabled(false);

        beaconManager.setForegroundScanPeriod(101L);
        beaconManager.setForegroundBetweenScanPeriod(0L);
        beaconManager.setBackgroundScanPeriod(101L);
        beaconManager.setBackgroundBetweenScanPeriod(0L);

        beaconRegion = new Region(
            "beacon-region",
            null,
            Identifier.parse(INSTANCE_ID),
            null);

        beaconManager.bind(this);
    }

    @Override
    public void onBeaconServiceConnect() {
        beaconManager.addMonitorNotifier(this);
        try {
           beaconManager.startMonitoringBeaconsInRegion(beaconRegion);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void didEnterRegion(Region region) {
        beaconManager.addRangeNotifier(this);
        try {
            beaconManager.startRangingBeaconsInRegion(beaconRegion);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void didExitRegion(Region region) {
        try {
            beaconManager.stopRangingBeaconsInRegion(beaconRegion);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void didDetermineStateForRegion(int i, Region region) {
        switch (i) {
            case 0:
                Log.e("BEACON MANAGER", "Beacon out of region");
                break;
            case 1:
                Log.e("BEACON MANAGER", "Beacon entered in region");
                break;
        }
    }

    @Override
    public void didRangeBeaconsInRegion(final Collection<Beacon> beacons, Region region) {
        Log.e("BEACON MANAGER", "Frame received");
    }
}

К сожалению, я встретил два вида проблем:

  1. иногда маяку требуется очень много времени, чтобы войти в регион;
  2. часто маяк выходит из региона, кажется, без причины, хотя разрыв с последним полученным кадром намного меньше, чем 10 сек (период выхода по-прежнему остается периодом по умолчанию); ниже logcat:

    04-24 11:46:04.669 8254-10315/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:04.838 8254-10316/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:04.983 8254-10317/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:05.199 8254-10323/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:05.375 8254-10324/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:05.527 8254-10325/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:05.697 8254-10328/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:05.884 8254-10332/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:06.028 8254-10333/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:06.179 8254-10334/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:06.380 8254-10340/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:06.536 8254-10341/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:06.688 8254-10342/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:06.862 8254-10348/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:06.999 8254-10350/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
    04-24 11:46:07.204 8254-10351/com.applications.r08y.beaconreader E/BEACON MANAGER: Beacon out of region
    

Может ли кто-нибудь любезно объяснить мне, почему это произошло? Что я могу сделать, чтобы сделать программное обеспечение более надежным?

Спасибо

--- РЕДАКТИРОВАТЬ ---

вот logcat после добавления setDebug (True)

04-24 15:04:12.045 17067-17082/com.applications.r08y.beaconreader I/art: Debugger is active
04-24 15:04:12.187 17067-17067/com.applications.r08y.beaconreader I/System.out: Debugger has connected
04-24 15:04:12.187 17067-17067/com.applications.r08y.beaconreader I/System.out: waiting for debugger to settle...

... в ожидании отладки для урегулирования

04-24 15:04:14.790 17067-17067/com.applications.r08y.beaconreader I/System.out: waiting for debugger to settle...
04-24 15:04:14.990 17067-17067/com.applications.r08y.beaconreader I/System.out: debugger has settled (1379)
04-24 15:04:15.077 17067-17067/com.applications.r08y.beaconreader I/InstantRun: starting instant run server: is main process
04-24 15:04:15.245 17067-17067/com.applications.r08y.beaconreader I/BeaconService: beaconService version 2.9 is starting up
04-24 15:04:15.247 17067-17067/com.applications.r08y.beaconreader W/BluetoothCrashResolver: Can't read macs from BluetoothCrashResolverState.txt
04-24 15:04:15.253 17067-17067/com.applications.r08y.beaconreader I/CycledLeScanner: This Android 5.0.  We are using new scanning APIs
04-24 15:04:15.261 17067-17067/com.applications.r08y.beaconreader W/ModelSpecificDistanceCalculator: App has no android.permission.INTERNET permission.  Cannot check for distance model updates
04-24 15:04:15.284 17067-17067/com.applications.r08y.beaconreader W/ModelSpecificDistanceCalculator: Cannot find match for this device.  Using default
04-24 15:04:15.284 17067-17067/com.applications.r08y.beaconreader W/ModelSpecificDistanceCalculator: Cannot find match for this device.  Using default
04-24 15:04:15.288 17067-17067/com.applications.r08y.beaconreader I/BeaconService: binding
04-24 15:04:15.313 17067-17169/com.applications.r08y.beaconreader I/OpenGLRenderer: Initialized EGL, version 1.4
04-24 15:04:15.333 17067-17067/com.applications.r08y.beaconreader E/BEACON MANAGER: Beacon out of region
04-24 15:04:15.353 17067-17169/com.applications.r08y.beaconreader E/libEGL: cache file failed CRC check
04-24 15:04:15.433 17067-17067/com.applications.r08y.beaconreader I/BeaconService: start monitoring received
04-24 15:04:15.443 17067-17067/com.applications.r08y.beaconreader I/CycledLeScanner: Adjusted scanStopTime to be 101
04-24 15:04:38.403 17067-17087/com.applications.r08y.beaconreader I/art: Background partial concurrent mark sweep GC freed 5309(314KB) AllocSpace objects, 1(20KB) LOS objects, 39% free, 1695KB/2MB, paused 10.900ms total 41.600ms
04-24 15:04:44.222 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={} ,callback=org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c
04-24 15:04:44.235 17067-17067/com.applications.r08y.beaconreader E/BluetoothLeScanner: application registeration exception
                                                                                    android.os.DeadObjectException
                                                                                        at android.os.BinderProxy.transactNative(Native Method)
                                                                                        at android.os.BinderProxy.transact(Binder.java:504)
                                                                                        at android.bluetooth.IBluetoothGatt$Stub$Proxy.registerClient(IBluetoothGatt.java:851)
                                                                                        at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper.startRegisteration(BluetoothLeScanner.java:245)
                                                                                        at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:137)
                                                                                        at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:106)
                                                                                        at org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop.startScan(CycledLeScannerForLollipop.java:187)
                                                                                        at org.altbeacon.beacon.service.scanner.CycledLeScanner.scanLeDevice(CycledLeScanner.java:190)
                                                                                        at org.altbeacon.beacon.service.scanner.CycledLeScanner.finishScanCycle(CycledLeScanner.java:266)
                                                                                        at org.altbeacon.beacon.service.scanner.CycledLeScanner.scheduleScanCycleStop(CycledLeScanner.java:239)
                                                                                        at org.altbeacon.beacon.service.scanner.CycledLeScanner$1.run(CycledLeScanner.java:235)
                                                                                        at android.os.Handler.handleCallback(Handler.java:815)
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                                        at android.os.Looper.loop(Looper.java:194)
                                                                                        at android.app.ActivityThread.main(ActivityThread.java:5546)
                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                        at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
04-24 15:04:44.236 17067-17067/com.applications.r08y.beaconreader E/CycledLeScannerForLollipop: Scan Failed
04-24 15:04:44.236 17067-17067/com.applications.r08y.beaconreader E/CycledLeScannerForLollipop: Scan Failed
04-24 15:04:44.339 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={} ,callback=org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c
04-24 15:04:44.342 17067-17067/com.applications.r08y.beaconreader E/BluetoothLeScanner: application registeration exception
                                                                                    android.os.DeadObjectException
                                                                                        at android.os.BinderProxy.transactNative(Native Method)
                                                                                        at android.os.BinderProxy.transact(Binder.java:504)
                                                                                        at android.bluetooth.IBluetoothGatt$Stub$Proxy.registerClient(IBluetoothGatt.java:851)
                                                                                        at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper.startRegisteration(BluetoothLeScanner.java:245)
                                                                                        at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:137)
                                                                                        at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:106)
                                                                                        at org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop.startScan(CycledLeScannerForLollipop.java:187)
                                                                                        at org.altbeacon.beacon.service.scanner.CycledLeScanner.scanLeDevice(CycledLeScanner.java:190)
                                                                                        at org.altbeacon.beacon.service.scanner.CycledLeScanner.finishScanCycle(CycledLeScanner.java:266)
                                                                                        at org.altbeacon.beacon.service.scanner.CycledLeScanner.scheduleScanCycleStop(CycledLeScanner.java:239)
                                                                                        at org.altbeacon.beacon.service.scanner.CycledLeScanner$1.run(CycledLeScanner.java:235)
                                                                                        at android.os.Handler.handleCallback(Handler.java:815)
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                                        at android.os.Looper.loop(Looper.java:194)
                                                                                        at android.app.ActivityThread.main(ActivityThread.java:5546)
                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                        at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
04-24 15:04:44.343 17067-17067/com.applications.r08y.beaconreader E/CycledLeScannerForLollipop: Scan Failed
04-24 15:04:44.343 17067-17067/com.applications.r08y.beaconreader E/CycledLeScannerForLollipop: Scan Failed
04-24 15:04:44.447 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={} ,callback=org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c
04-24 15:04:44.457 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@2aa317e2}

... попытки сканирования...

04-24 15:05:33.076 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@286a8874} ,callback=org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c
04-24 15:05:33.083 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@28a7a19d}
04-24 15:05:33.152 17067-18004/com.applications.r08y.beaconreader E/BEACON MANAGER: Beacon entered in region
04-24 15:05:33.152 17067-17067/com.applications.r08y.beaconreader I/BeaconService: start ranging received
04-24 15:05:33.189 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@28a7a19d} ,callback=org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c
04-24 15:05:33.195 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@30139a5b}

... кадры принимаются примерно каждые 100 мсек

04-24 15:05:43.093 17067-18175/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 15:05:43.207 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@13604c34} ,callback=org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c
04-24 15:05:43.223 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@6cff7a0}
04-24 15:05:43.231 17067-18176/com.applications.r08y.beaconreader E/BEACON MANAGER: Beacon out of region
04-24 15:05:43.232 17067-17067/com.applications.r08y.beaconreader I/BeaconService: stop ranging received
04-24 15:05:43.236 17067-18176/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 15:05:43.328 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@6cff7a0} ,callback=org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c
04-24 15:05:43.340 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@3ccedcc}

... сканирование

04-24 15:05:45.558 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@214d61fc} ,callback=org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c
04-24 15:05:45.590 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@6b5b085}
04-24 15:05:45.684 17067-18203/com.applications.r08y.beaconreader E/BEACON MANAGER: Beacon entered in region
04-24 15:05:45.684 17067-17067/com.applications.r08y.beaconreader I/BeaconService: start ranging received
04-24 15:05:45.695 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@6b5b085} ,callback=org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c
04-24 15:05:45.700 17067-17067/com.applications.r08y.beaconreader I/BluetoothLeScanner: startRegisteration: mLeScanClients={org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$2@3b05192c=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@192100e7}

--- РЕДАКТИРОВАТЬ 2 --- LogCat со временем сканирования 501L

04-24 19:25:35.423 19998-21049/com.applications.r08y.beaconreader E/BEACON MANAGER: Beacon entered in region
04-24 19:25:35.679 19998-21055/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:36.206 19998-21061/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:36.735 19998-21067/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:37.257 19998-21073/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:37.781 19998-21079/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:38.343 19998-21087/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:38.931 19998-21095/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:39.766 19998-21102/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:40.341 19998-21108/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:40.940 19998-21114/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:41.514 19998-21120/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:42.053 19998-21126/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:42.648 19998-21137/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:43.182 19998-21142/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:43.740 19998-21148/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:44.309 19998-21158/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:44.861 19998-21166/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:45.421 19998-21172/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:25:46.032 19998-21178/com.applications.r08y.beaconreader E/BEACON MANAGER: Beacon out of region
04-24 19:25:46.043 19998-21178/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:00.424 19998-21314/com.applications.r08y.beaconreader E/BEACON MANAGER: Beacon entered in region
04-24 19:26:00.685 19998-21319/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:01.264 19998-21325/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:01.836 19998-21331/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:02.387 19998-21335/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:02.950 19998-21342/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:03.513 19998-21347/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:04.067 19998-21353/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:04.672 19998-21362/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:05.215 19998-21366/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:05.805 19998-21373/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:06.387 19998-21380/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:06.936 19998-21385/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:07.515 19998-21392/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:08.103 19998-21400/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:08.714 19998-21406/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:09.320 19998-21411/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:09.874 19998-21413/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:10.498 19998-21419/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received
04-24 19:26:11.081 19998-21424/com.applications.r08y.beaconreader E/BEACON MANAGER: Beacon out of region
04-24 19:26:11.123 19998-21424/com.applications.r08y.beaconreader E/BEACON MANAGER: Frame received

1 ответ

Частично причиной получения ненадежных обнаружений является настроенный короткий период сканирования 101 мс.

Зачем? Библиотека маяков Android останавливает сканирование BLE в конце каждого периода сканирования, а затем перезапускает его. Это происходит потому, что некоторые старые устройства Android не могут обнаружить несколько идентичных рекламных сигналов маяка, если сканирование не было остановлено, а затем запущено снова. Большинство новых устройств ведут себя не так. Но всякий раз, когда сканирование останавливается и перезапускается, существует короткий период (зависит от устройства), когда пакеты не могут быть обнаружены. При цикле сканирования ~100 мс будет значительный процент времени, когда пакеты не могут быть обнаружены.

Частичное решение этой проблемы было реализовано в неизданной версии библиотеки, доступной в [ad-hoc build here]( https://github.com/AltBeacon/android-beacon-library/releases/tag/2.9.2-mpb2). Эта версия обнаружит, обнаружены ли когда-либо два идентичных пакета в одном цикле сканирования, и если это так, она больше не будет останавливать сканирование в конце каждого периода сканирования.

Вышеуказанное изменение, вероятно, решит проблему для вашего устройства, однако, даже с этим выпуском библиотеки вам потребуется цикл сканирования, который будет по крайней мере достаточно длинным для захвата двух пакетов за один цикл: > 200 мс для передачи маяка в 10Гц. Если вы хотите, вы можете начать с более длительного периода сканирования, чтобы это обнаружение имело место, затем после получения обратного вызова didEnterRegion измените период сканирования на что-то более короткое.

Другие вопросы по тегам