Kontakt region entered and abandoned constantly

183 views Asked by At

I am monitoring Kontakt beacons in my app and I am using SpaceListener in order to know when the user enter a region and when user abandoned the region. The problem is that I received constantly and region entered and region abandoned. I am using version 3.2.0 of the library. Beacons are only a 1m of me and neither the beacons neither me are moving. Is this the normal behavior?

@Override
public void onCreate() {
        super.onCreate();
        proximityManager = new ProximityManager(this);
        proximityManager.setIBeaconListener(createIBeaconListener());
        proximityManager.setSpaceListener(new SpaceListener() {
            @Override
            public void onRegionEntered(IBeaconRegion region) {
                Log.d(TAG,"onRegionEntered");
            }

            @Override
            public void onRegionAbandoned(IBeaconRegion region) {
                Log.d(TAG,"onRegionAbandoned");
            }

            @Override
            public void onNamespaceEntered(IEddystoneNamespace namespace) {

            }

            @Override
            public void onNamespaceAbandoned(IEddystoneNamespace namespace) {

            }
        });
        proximityManager.configuration()
                .scanMode(ScanMode.BALANCED)
                .activityCheckConfiguration(ActivityCheckConfiguration.MINIMAL)
                .forceScanConfiguration(ForceScanConfiguration.MINIMAL);
    }

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
        super.onStartCommand(intent, flags, startId);
        proximityManager.connect(new OnServiceReadyListener() {
                    @Override
                    public void onServiceReady() {
                        proximityManager.startScanning();

                    }
                });
        return START_STICKY;
}

private IBeaconListener createIBeaconListener() {
        return new SimpleIBeaconListener() {
            private SFBeacon nearestBeacon;
            @Override
            public void onIBeaconDiscovered(IBeaconDevice iBeaconDevice, IBeaconRegion region) {
                Log.d(TAG,"----------------------------------------------");
                Log.d(TAG,"Detected: "+iBeaconDevice.getUniqueId()+" "+iBeaconDevice.getProximityUUID().toString()+" "+iBeaconDevice.getMajor()+" "+iBeaconDevice.getMinor());
            }
}
1

There are 1 answers

2
davidgyoung On

While I am not an expert on the Kontakt Android SDK, this kind of problem typically happens when the beacon is detected only intermittently by the mobile device. This can have a number of causes:

  1. The beacon may have too weak of a signal because its transmitter power is set too low.
  2. The beacon may have too weak of a signal because it is too far away from the detecting phone.
  3. The beacon may not be advertising often enough, this can be a problem if it is only adverting once every 5 seconds or so. Try to increase its advertising rate to 10Hz or more to see if the issue goes away.
  4. Android provides different scan modes, some of which gives more frequent updates. Try changing ScanMode.BALANCED to ScanMode.LOW_LATENCY