GooglePlayLocationUtils

Utility methods for interacting with Google Play Location Services to manage geofence registration, location requests, and geofence data store persistence.

Functions

Link copied to clipboard

Delete the cache of registered geofences. This will cause any geofences passed to .registerGeofencesWithGooglePlayIfNecessary on the next call to that method to be registered.

Link copied to clipboard
private fun registerGeofencesWithGeofencingClient(context: Context, newGeofencesToRegister: List<BrazeGeofence>, geofenceRequestIntent: PendingIntent, dataStoreProvider: GeofenceDataStoreProvider)

Registers a list of Geofence with a com.google.android.gms.location.GeofencingClient.

fun registerGeofencesWithGooglePlayIfNecessary(context: Context, desiredGeofencesToRegister: List<BrazeGeofence>, geofenceRequestIntent: PendingIntent, dataStoreProvider: GeofenceDataStoreProvider, removalFunction: (List<String>) -> Unit = { removeGeofencesRegisteredWithGeofencingClient(context, it, dataStoreProvider) }, registerFunction: (List<BrazeGeofence>) -> Unit = { registerGeofencesWithGeofencingClient(context, it, geofenceRequestIntent, dataStoreProvider) })

Requests to register the given list of geofences with Google Play Location Services.

Link copied to clipboard
private fun removeGeofencesFromLocalStorage(obsoleteGeofenceIds: List<String>, dataStoreProvider: GeofenceDataStoreProvider)

Removes the list of BrazeGeofence which are now un-registered with Google Play Services.

internal fun removeGeofencesRegisteredWithGeofencingClient(context: Context, obsoleteGeofenceIds: List<String>, dataStoreProvider: GeofenceDataStoreProvider)

Un-registers a list of Geofence with a com.google.android.gms.location.GeofencingClient.

Requests a single location update from Google Play Location Services for the given pending intent.

Link copied to clipboard

Stores the list of BrazeGeofence which are successfully registered.