My main requirement would be to have a service having its own process and trigger its own geofencing event. I'd like the user to be notified from the notification center when he enters a geofence, even if the app is killed.
I read about services and this seems pretty clear to me, the Android documentation is dense so I managed to understand how to start a service with its own process, and also how it is able to communicate with the app using Messenger.
Then there is this code sample from Google showing how to use geofencing with google play services: Google samples geofencing
What I found so far is that we have to use an IntentService to trigger geofencing events, and from the docs I've read it states that an IntentService terminates itself when its work is done. And I tested a bit also, it looks like the Intentservice gets killed when the app gets killed, which doesn't surprise me regarding the documentation.
So my question is, how could we perform a geofencing service having its own process? Is that possible to avoid using IntentService for this matter?
EDIT:
The reason I wanna do this, is that the user can set geofence "reminders", it is based on a daily usage. For instance imagine each day you arrive at your workplace, we should be able to fire an alarm (or a notification) when we enter this geofence regarding the app is running or not. We don't want the user to worry about having the app running in background.
I actually realized this by creating a service with its own process. This service is bound with IPC communication, my activity then registers to it when needed.
Within this service, I did apply the geofencing example that I found in google samples. It uses an IntentService to trigger geofencing events. Instead of using this logic in my activity, I use it in my own service. Now I can receive notifications even when my app is killed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With