location-samples icon indicating copy to clipboard operation
location-samples copied to clipboard

Please modify code make this sample working even the app is killed by using service

Open umarataTribyss opened this issue 6 years ago • 6 comments

Hello @dturner ,

I am using this sample and it works very well when the app is in foreground or in background but when I kill it from recents then no geofence is triggering.

Please make use of service for setting geofences in that to make this app working even when the app is killed.

If you have no time then allow my pull request so I can modify the code myself.

Thanks

umarataTribyss avatar Mar 04 '19 06:03 umarataTribyss

@umarataTribyss That sound great, But can you please give me a bit idea that how geo fencing work as app get killed? Is it work on android oreo? Did you use foreground service to update geo fencing result?

itman85 avatar Mar 04 '19 07:03 itman85

For pre Oreo device we can use a Sticky Service which runs in background even the app is killed,

And yes for Oreo we need to implement Foreground service.

I actually used Foreground Service in one of my app and it works well even the app is killed in Oreo and later devices.

umarataTribyss avatar Mar 04 '19 08:03 umarataTribyss

@umarataTribyss: I've also implemented a Foreground Service (with notification) and the solution works fine. But not when using Android Auto. Does your solution works during Android Auto is running?

smejkal avatar Mar 05 '19 21:03 smejkal

@umarataTribyss could you provide a snippet of how you implemented the foreground service? I've been trying to get this to work but no success.

Onwa1kenobi avatar Mar 27 '19 16:03 Onwa1kenobi

@umarataTribyss it will be VERY helpful if you share your code!

nickoledimitrova avatar May 08 '19 10:05 nickoledimitrova

Geofencing is not working for me when app is killed. Working fine when app is in background. I am using broadcast receiver and JonIntentService together. Please suggest.

arundaskv avatar May 14 '20 12:05 arundaskv