Search code examples
javaandroidmobilegeofencingandroid-geofence

Keep Geofences alive on app close


I have a small problem:

I'm adding geofences on my first app start with the LocationServices.GeofencingApi. After that I tell the app that it should not call this at the next app start anymore.

Now when I close the app and it starts again (from a service) it crashes (as I am not adding any Geofences in the request).

But I want them to stay alive forever, so that I don't have to call addGeofence anymore (like in iOS).

Now my question: Is that possible? And shouldn't they be stored somewhere on the Google Cloud or the services?

Thank you for any kind of help!


Solution

  • It was my mistake.

    For everyone in the future: Use the GeofencingClient instead of the GoogleApiClient. Don't know why, but now it works ¯_(ツ)_/¯