Skip to content

Commit

Permalink
Always clear last location if successful track (#272)
Browse files Browse the repository at this point in the history
* Always clear last location if succesful track

* Always use System.currentTimeMillis()

* Always clear ReplayBuffer upon successful request

---------

Co-authored-by: Tim Julien <[email protected]>
  • Loading branch information
lmeier and tjulien authored Feb 28, 2023
1 parent e0e0364 commit aa4102d
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions sdk/src/main/java/io/radar/sdk/RadarApiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,6 @@ internal class RadarApiClient(
var replays = Radar.getReplays()
val replayCount = replays.size
var nowMS = System.currentTimeMillis()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
nowMS = SystemClock.elapsedRealtimeNanos() / 1000000
}
val replaying = replayCount > 0 && options.replay == RadarTrackingOptions.RadarTrackingOptionsReplay.ALL
if (replaying) {
val replayList = mutableListOf<JSONObject>()
Expand Down Expand Up @@ -329,12 +326,8 @@ internal class RadarApiClient(
return
}

if (replaying) {
Radar.clearReplays()
} else {
RadarState.setLastFailedStoppedLocation(context, null)
}

Radar.clearReplays()
RadarState.setLastFailedStoppedLocation(context, null)
Radar.flushLogs()

val config = RadarConfig.fromJson(res)
Expand Down

0 comments on commit aa4102d

Please sign in to comment.