Monitoring when the app is not running


#1

Hi,
I have read various old posts about monitoring for iBeacons on Android when the app is not running and it appears that it is not possible on Android as it is not part of the OS like iOS. From what I can see the best advice is to use as a geo-fence which, when entered starts monitoring using the BeaconManager. Is this still the case now?

Clive


#2

The way our Android SDK is designed, monitoring for long periods of time should work perfectly fine. For example, if all the Activities in your app get terminated due to memory pressure, scanning for beacons still continues in a service, and if an enter/exit is detected, our SDK will re-create your Application subclass, and you’ll be able to handle the event. The key here is to put your onEntered/onExited code into the Application subclass, and not into any Activity, as described in our monitoring tutorial:

http://developer.estimote.com/android/tutorial/part-2-background-monitoring/

The one thing we can’t do on Android is, if the user manually kills the app (e.g., in the app switcher), all scanning stops and we can’t bring it back, unlike on iOS.


#3

Thanks for explaining that, I guess when the kill from the switcher there is not a lot you can do. Hopefully manually closing of the app is not a common occurrence.


#4

@heypiotr i am wondering if this is still the case. Did you guys ended up implementing an workaround for this Android issue? Is it still the case that if user kills the app from app switcher there is no way to receive monitoring enter/exit events?

If it is still the case can you please suggest a workaround?

Thanks


#5

yeah its become a big issue, same problem with me, when App is not open its not monitoring unless you did’t open app again
it comes in Android 6 and onward


#6

I’m facing this issue as well and would really like to find a way to work around this limitation if possible. I noticed that in the onStartCommand() method of BeaconService, it returns START_NOT_STICKY. The Android documentation states that returning START_STICKY instead will restart the service if it is killed. Could this be a simple work around?

I’ve imported the SDK into my project using gradle so I cannot simple edit this return statement to test this out.


#7

Hey @rluppino,

We added awesome support for handling background scanning in our new ProximitySDK. I really encourage you to try it out - for now it is in ALPHA stage, but we are constantly working on it really hard. Please, track this thread for more info.

Currently, we are hosting our ProximitySDK on a separate branch. Soon will be introduced as a totally new repository.

Also, see this thread, where I explained some ideas behind proper background monitoring.

Cheers!


#8

Hi @paweldylag thanks for your reply. The new SDK sounds good but as it is still in alpha stage, it is not suitable for me to use in a production app. Is there any way that I can use the current Estimote SDK to ensure that monitoring is still active when the app is killed?