I’m testing region monitoring on my Android application using Android SDK but I have serious problem.
When I’m monitoring region (UUID + major) it looks like it works very random:
I have my Android phone and beacon on my desk, I get every few minutes (2-5) notification about entry into monitored region and suddenly notification about exit from monitoring range but my phone and beacon are still at the same place!
I suspect that sometimes the phone unnecessarily “catches” the exit of the region and then notify its re-entry into the region. The distance from my phone to beacon is about 1 meter. Why is this happening ?? Please help!
Thanks for detailed report. I’ll be taking closer look into that.
Let me rephrase your problem if I understood it correctly. Exit/enter regions events fire after each other every time although phone is next to the beacon. Correct?
@wiktor
I have the exact same problem. Everything was working fine this morning, and all of a sudden onExitedRegion gets triggered right after onEnteredRegion. Sometimes right after each other. Sometimes with the 30s delay in between.
I’m using a Samsung Galaxy Note 4 on 5.0.1 and a Nexus 7 (2013) on 5.1.1.
I’m using dagger 2 to hold a singleton of my BeaconManager in Application and then use it in a service to run indefinitely. I configure it with a UUID and major/minor set to null, since I’m monitoring a region defined by 3 beacons. (All have same UUID).
I configure it with following code, with region being a static Region instance variable.
region = new Region(REGION_TAG,
UUID.fromString(preferences.getMotherBeaconUuid()),
null,
null);
beaconManager.startMonitoring(region);
beaconManager.setBackgroundScanPeriod(5, preferences.getBeaconBackgroundScanPeriod());
I set the the scanPeriod hardcoded to 5, since that’s the default. And I decided to leave this untouched.
In the case that the UUID would change, I first stop monitoring like so:
beaconManager.stopMonitoring(region);
(In my current scenario, this has not occurred. So the monitoring only gets started once, never “restarted” with a new UUID)
Any follow-up on this? I am facing the same problem. It’s very annoying. There seem to be differences with regards to the device used though. Using my Nexus 5X it enters/exits like every minute, with the Nexus 5 it does that like every 2-3 minutes, whereas my friends Samsung phone would stay connected for up to 15 minutes before this happens.
The beacon that I am testing it with broadcasts at 950ms, but I also tested it with 100ms and strongest signal. The outcome is very similar unfortunately.
Can you enable debug logging and attach here the output from logcat? (Plus, if you could write at what time you got a “false” exit, so that it’s easier for us to navigate the logs.)
Well, not sure if that’s what you want to hear, but I fixed it by switching to using the AltBeacon library and changing the Estimote Beacon broadcast to EddyStone. I tried literally everything to make it work with the Estimote SDK, but the disconnects just wouldn’t stop. Hopefully this gets fixed in a future version.
Thank you NikEy for sharing your experience. I’ve tried using AltBeacon via iBeacon protocol and faced the same issue, could it be that the problem related to iBeacon with android and not the Estimote SDK?
The problem is that Estimote Beacons can only broadcast one type of packet at a time, so if I switched to Eddystone there would effect the iOS version of my work as well.
I noticed the AlarmManager being triggered every 10 seconds in these logs. The default value should be 30 seconds. Have you modified the scan periods (using the setBackgroundScanPeriod method)?