Monitoring region problem

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

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)