Search code examples
androidgoogle-mapsandroid-locationandroid-geofence

Implementing Geo-fencing - Receiving geo-fences transition events when the app is not running


I'm implementing Geo-fences. It works quite well, but their transition events only get trigger when the app is in background or foreground. I have an IntentService that receives the geo-fences transitions events, but my problem is that this intent service only receives updates if the app is running.

The implementation has an standard LocationService for managing the geo-fences by the app when is running, then an IntentService that gets notified by the OS when a geo-fence transition is detected.

Have you got any solution to receive transitions even when the app is not running at all?

Thank you.


Solution

  • I found a solution as per official documentation.

    The recommended min radius should be between 100 to 150 metres, specially if you are using PRIORITY_LOW_POWER or PRIORITY_BALANCED_POWER_ACCURACY in your location request.

    The issue I had was that I was saving the geo-fences to the device with a very small radius (e.g 20 metres) in which case the device didn't detect the geo-fence transition events at all when the app is not running (not in background and foreground).