Monitoring region problem

Thanks for confirming you haven’t modified the scan periods—this likely means a bug in our SDK then. We’ll look into that. Thank you so much for your help so far, we wouldn’t have been able to track this one down if not for these logs!

1 Like

I’m also having the same problem, hoping for an update soon :smiley: using the latest 0.10.2 version of the library

I’m having similar problems.
Latest SDK for Android. Using Galaxy S3 Mini as test device. The problem is two fold:

  1. Whilst stationary within a region I get random Exit Region notifications.
  2. Once I’ve entered a region I continue getting Region Entered notifications … not always in relation to the random exit notification. Timing between these notification seems to be around 1 minute.

In point 2 above could this be that Monitoring stops and starts again during the device’s time within the region? Thus SDK is not “remembering” that the device had already entered the region? From the log I can see Monitoring continues even after entering a region. I guess this is necessary so as to know when device has exited. This I can live with on condition I place the Notification such that it is only activated once on Entry … how may I do this? … i.e. fire Notification once on Region Entry … then stop Notification … until Region Exit.

These 2 points could be related if the SDK tells the device that it has exited the region when Monitoring has stopped whilst still within the region? If the two controls (enter and exit) are out of sync then I can see the above scenario taking place.

EDIT #1:
I now see this thread … https://github.com/Estimote/Android-SDK/issues/130. Has this been resolved? It seems Monitoring has been an issue for many months. I use some Estimote beacons and some Kontak … both with Android Altbeacon SDK … now [last 3 weeks] trying project with purely Estimote and Estimote SDK [Android] … please let me know if Estimote SDK has been fixed as per above bug.

EDIT #2:
I have now tested with both API 19 and 21 [maxTarget 23] … same result. Next step is to remove onExitedRegion from my code. Shall test if this helps.

Can you try lowering your beacons’ advertising interval to 200–300 ms, check if that fixes the problem?

I’ve observed this on Moto X (2nd Generation) running 6.0; but not on Nexus 6. Tried advertising intervals of 300ms and 200ms without success; Also tried setRegionExitExpiration to 30s, again, without success. Running latest and greatest 0.10.6

log.txt (4.1 KB)

I am running the estimote example app of background monitoring with SDK version 0.10.6.

I opened the app with beacon in range of the phone. For 10 minutes nothing went wrong and app worked as it should have.

But after 10 minutes I turned on my WiFi and in the background usual apps started to update from play-store. After turning on the WiFi after about 50 or seconds later my phone showed me that beacon was out of range though it was in range physically then again after few seconds the app showed that beacon entered the range. This cycle of entering and exiting continued till the time my WiFi was turned on and apps were being updated in the background. I let my apps to be updated. After the updation i kept my WiFi on but nothing was getting downloaded but still onEnteredRegion, onExitedRegion events got triggered.

Then I turned off my WiFi and there were no more onEnteredRegion, onExitedRegion events and app started working properly. Then after another 10 minutes I again turned on my WiFi and did nothing at all( i.e. no downloading or no surfing the internet) still it resulted in same onEnteredRegion, onExitedRegion events getting fired.

Then on Second experiment I added this line in my code.

beaconManager.setBackgroundScanPeriod(25000, 30000);

After adding this line nothing was different and above cycle of entering and exiting continued.

Conclusion:
When WiFi is turned off and only Bluetooth is active then app works as it should be. But after turning on WiFi(Even if nothing is getting actively downloaded in the background) app misbehaves.

Sorry if information in this post is irrelevant but I just thought that I should share with others what I have observed it just might be helpful for someone.

I also checked my RAM and it was almost 33% free for the whole experiment.

My Phone details are as follows:
Model : Micromax Unite3 Q372
OS : Android 5.0.
RAM : 1 GB

It’s happening to me too. Moto E2 (4G LTE) 6.0. Exit region after 30 seconds then re-enter region at the same time. Phone keeps vibrating there’s a new notification.
How can this bug be present for more than a year?

Are you on the latest SDK? What advertising interval are your beacons set to? Did you modify the default backgroundScanPeriod?

This is really less of a bug, and more, Android devices differ vastly when it comes to their Bluetooth support. If a device can’t detect a beacon for a while, our SDK assumes you went out of range, when in reality you might still be in range, just the phone has trouble detecting the beacon. This is where lowering the advertising interval helps (= beacon “pings” more often, and the chance for the phone to detect it goes up). Or, extending the background scan period, which gives the phone more time to detect the beacon.

Did anyone find a solution to this ?

I am facing the exact same problem on Android, Estimote SDK version 0.13.0 (latest to date). I have already tested monitoring beacons with 3 different devices on different OS versions, all have the same behaviour, or rather bug.

I keep getting onEnteredRegion / onExitRegion repeatedly, and with milliseconds in between those calls, and this keeps looping forever.

@e_sharedesk, can let me know the advertising interval you’re using on your beacons, and whether you modified the default backgroundScanPeriod?

I am also facing same issue in Android using latest Estimote SDK 0.13.
I am using iBeacon as Packet. Broadcasting Power Weak (-20dBm), Advertising Interval 300 ms.
I am getting false alerts for onEnteredRegion / onExitRegion continuously.

I’m also seeing the same issue with the latest SDK on a Samsung Galaxy S7 Edge. I’ve tried turning Wifi off and it made no difference.

I also experience the same issue with this app (https://github.com/vitas/beaconloc) which uses the Altbeacon library so maybe it’s an Android issue? I

@heypiotr, I tried with default scan period which is said to be “scans for 10 seconds and sleeps for 30 seconds”, there are a lot of wrong enter/exit events when monitoring in the background on Android. When I tried with “scans for 10 seconds and sleeps for 10 seconds” by changing as below:

beaconManager = new BeaconManager(getApplicationContext());
beaconManager.setBackgroundScanPeriod(10000, 10000);
beaconManager.setMonitoringListener(new BeaconManager.MonitoringListener() {
    @Override
    public void onEnteredRegion(Region region, List<Beacon> list) {
        Log.d(TAG, "onEnteredRegion: " + list);
    }
    @Override
    public void onExitedRegion(Region region) {
        Log.d(TAG, "onExitedRegion: " + region);
    }
});
beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
    @Override
    public void onServiceReady() {
        beaconManager.startMonitoring(new Region("region 1",
                UUID.fromString("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"), 11111, 11111));
        beaconManager.startMonitoring(new Region("region 2",
                UUID.fromString("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"), 22222, 22222));
        beaconManager.startMonitoring(new Region("region 3",
                UUID.fromString("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"), 33333, 33333));
    }
});

The number of wrong events decreases to some extent at the beginning, but when you put the device there for a while, I still received lots of wrong enter/exit events even if I left the beacons alone(only the beacons not in sleep mode will fire the wrong enter/exit events).

Besides, I am using flip to sleep function to test enter/exit region and the Estimote SDK version is ‘com.estimote:sdk:0.13.0:@aar.