From 047fbc62bfc1f887d5796fda26efc69343c6494b Mon Sep 17 00:00:00 2001 From: Liam Meier Date: Mon, 28 Oct 2024 15:38:32 -0400 Subject: [PATCH 1/2] only clear geofences when we have a new array of nearby geofences --- sdk/src/main/java/io/radar/sdk/RadarLocationManager.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/src/main/java/io/radar/sdk/RadarLocationManager.kt b/sdk/src/main/java/io/radar/sdk/RadarLocationManager.kt index c516105d..fbe90bbe 100644 --- a/sdk/src/main/java/io/radar/sdk/RadarLocationManager.kt +++ b/sdk/src/main/java/io/radar/sdk/RadarLocationManager.kt @@ -354,8 +354,10 @@ internal class RadarLocationManager( } private fun replaceSyncedGeofences(radarGeofences: Array?) { - this.removeSyncedGeofences() { success -> - this.addSyncedGeofences(radarGeofences) + if (radarGeofences != null) { + this.removeSyncedGeofences() { success -> + this.addSyncedGeofences(radarGeofences) + } } } From 2c2dfe894849607abbff8b2dbacf382f522893b0 Mon Sep 17 00:00:00 2001 From: Liam Meier Date: Wed, 30 Oct 2024 11:57:27 -0400 Subject: [PATCH 2/2] log when skipping --- sdk/src/main/java/io/radar/sdk/RadarLocationManager.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/src/main/java/io/radar/sdk/RadarLocationManager.kt b/sdk/src/main/java/io/radar/sdk/RadarLocationManager.kt index fbe90bbe..85d46072 100644 --- a/sdk/src/main/java/io/radar/sdk/RadarLocationManager.kt +++ b/sdk/src/main/java/io/radar/sdk/RadarLocationManager.kt @@ -358,6 +358,8 @@ internal class RadarLocationManager( this.removeSyncedGeofences() { success -> this.addSyncedGeofences(radarGeofences) } + } else { + logger.d("Skipping replace synced geofences") } }