Monitoring region problem

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!

Beacon OS: A3.2.0
Beacon HR: D3.4
Transmit power: -20dBm
Advertising interval: 883 ms
SDK version: 0.8.8@aar
AndroidOS: 5.0.2

1 Like

@tomcyr

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 yes, it’s correct. The phone is at the same place but enter/exit regions event triggers every few minutes.

@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.

Anyone found the solution to OP’s post?

Hi @Simon_Vergauwen,
We are doing right now internal testing for more robust monitoring and it is going out with next SDK release.

That said, can you provide me couple of details?

  1. Device as Android OS version?
  2. Where do you hold reference to BeaconManager? Have you configured it somehow?
  3. Which SDK version are you using?

@wiktor

  1. I’m using a Samsung Galaxy Note 4 on 5.0.1 and a Nexus 7 (2013) on 5.1.1.

  2. 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)

  3. I’m using the latest SDK 0.9.3

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.

What version of the SDK are you on? Can you see if you’re still experiencing it with the latest version? (0.9.7)

Hi Piotr,
I’m using the latest version 0.9.7.

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.

We are also having the same problem with random entry and exit events when a device is static within a region. iOS with sdk 3.8.2

@acpriest, that’s a different (iOS) problem, we already have a discussion going on about this here:

If you want to chime in in that topic, please do!

EDIT: Oh, I can see you already did. Silly me!

Any update on this issue? I’m facing the same problem also, with LG G4 device running Android 5.1 and version 0.9.7 of estimote sdk.

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.

02-23 09:48:45.755 10726-10726/? I/art: Late-enabling -Xcheck:jni
02-23 09:48:45.785 10726-10748/? I/art: Debugger is no longer active
02-23 09:48:46.025 10726-10726/? D/ContextHelper: convertTheme. context->name=com.example.norah.estimote themeResourceId=2131230766
02-23 09:48:46.055 10726-10726/? I/PhoneWindow: [generateLayout] setColorNavigationBar => color=0x ff000001
02-23 09:48:46.065 10726-10726/? D/PhoneWindowEx: [PWEx][generateLayout] setNavigationBarColor2 : colors=0xfff5f5f5
02-23 09:48:46.065 10726-10726/? I/PhoneWindow: [setNavigationBarColor2] color=0x fff5f5f5
02-23 09:48:46.125 10726-10726/? I/Activity: Activity.onPostResume() called
02-23 09:48:46.145 10726-10779/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
02-23 09:48:46.145 10726-10726/? D/Atlas: Validating map…
02-23 09:48:46.165 10726-10726/? I/EstimoteSDK: com.estimote.sdk.service.BeaconService.onCreate:233 Creating service
02-23 09:48:46.185 10726-10726/? D/EstimoteSDK: com.estimote.sdk.service.internal.PacketFilterProvider.createFilters:114 Filters updated: 1 filters
02-23 09:48:46.205 10726-10779/? I/Adreno: QUALCOMM build : efd53e6, I3c94fdbbc3
02-23 09:48:46.205 10726-10779/? I/Adreno: Build Date : 09/04/15
02-23 09:48:46.205 10726-10779/? I/Adreno: OpenGL ES Shader Compiler Version: E031.25.03.09
02-23 09:48:46.205 10726-10779/? I/Adreno: Local Branch :
02-23 09:48:46.205 10726-10779/? I/Adreno: Remote Branch :
02-23 09:48:46.205 10726-10779/? I/Adreno: Remote Branch :
02-23 09:48:46.205 10726-10779/? I/Adreno: Reconstruct Branch :
02-23 09:48:46.215 10726-10779/? I/OpenGLRenderer: Initialized EGL, version 1.4
02-23 09:48:46.225 10726-10779/? D/OpenGLRenderer: Enabling debug mode 0
02-23 09:48:46.315 10726-10780/? V/EstimoteSDK: com.estimote.sdk.service.BeaconService.startMonitoring:357 Starting monitoring: Region{identifier=monitored region, proximityUUID=b9407f30-f5f8-466e-aff9-25556b57fe6d, major=5132, minor=18014}
02-23 09:48:46.315 10726-10780/? D/EstimoteSDK: com.estimote.sdk.service.internal.PacketFilterProvider.createFilters:114 Filters updated: 2 filters
02-23 09:48:46.325 10726-10726/? I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@bde62a2 time:92959315
02-23 09:48:46.365 10726-10755/? D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:48:46.365 10726-10726/? D/status: Starting BLE scan
02-23 09:48:56.385 10726-10755/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:49:26.445 10726-10755/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:49:36.515 10726-10726/com.example.norah.estimote D/status: enter
02-23 09:49:56.515 10726-10755/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:49:56.515 10726-10726/com.example.norah.estimote D/status: exit
02-23 09:50:06.605 10726-10726/com.example.norah.estimote D/status: enter
02-23 09:50:17.605 10726-10726/com.example.norah.estimote D/status: exit
02-23 09:50:26.575 10726-10755/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:50:56.665 10726-10755/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:51:26.755 10726-10757/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:51:56.825 10726-10757/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:52:17.125 10726-10726/com.example.norah.estimote D/status: enter
02-23 09:52:26.895 10726-10757/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:52:36.985 10726-10726/com.example.norah.estimote D/status: exit
02-23 09:52:56.995 10726-10757/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:53:27.085 10726-10757/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:53:57.185 10726-10755/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:54:27.265 10726-10755/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:54:47.345 10726-10726/com.example.norah.estimote D/status: enter
02-23 09:54:57.365 10726-10755/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:54:57.365 10726-10726/com.example.norah.estimote D/status: exit
02-23 09:55:07.465 10726-10726/com.example.norah.estimote D/status: enter
02-23 09:55:17.575 10726-10726/com.example.norah.estimote D/status: exit
02-23 09:55:27.445 10726-10757/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8
02-23 09:55:57.575 10726-10757/com.example.norah.estimote D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=8

I have logged the actions of enter/exit as (status: exit/enter) on the previous log file. All the “status: exit” logs are false exit.

Thanks a lot!

Thanks @nqwifly, appreciate your help with that! Can you enable debug logging:

// Add this before all other beacon code
EstimoteSDK.enableDebugLogging(true)

… and attach the full output from the logcat then? (Best as a ZIP attachment, it will be too long to paste directly in the post.)

Hi heypiotr, attached are two files: log-full.txt (full device log) log-estimote.txt (application related log only).

log.zip (83.5 KB)

Thanks.

Thanks, really helpful!

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)?

No, haven’t modified anything. I literally followed the provided tutorial of monitoring!
Should I try to modify it to its expected value (30 seconds)?