Skip to content

Commit

Permalink
add buttons to example app, add passed check in getVerifiedLocationTo…
Browse files Browse the repository at this point in the history
…ken()
  • Loading branch information
nickpatrick committed Oct 22, 2024
1 parent 11194e0 commit 8d7dfd9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
26 changes: 25 additions & 1 deletion example/src/main/java/io/radar/example/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MainActivity : AppCompatActivity() {
setContentView(R.layout.activity_main)

val receiver = MyRadarReceiver()
Radar.initialize(this, "prj_test_pk_0000000000000000000000000000000000000000", receiver, Radar.RadarLocationServicesProvider.GOOGLE, true)
Radar.initialize(this, "org_test_pk_5857c63d9c1565175db8b00750808a66a002acb8", receiver, Radar.RadarLocationServicesProvider.GOOGLE, true)
Radar.sdkVersion().let { Log.i("version", it) }

val verifiedReceiver = object : RadarVerifiedReceiver() {
Expand Down Expand Up @@ -109,6 +109,26 @@ class MainActivity : AppCompatActivity() {
}
}

createButton("startTrackingVerified") {
Radar.startTrackingVerified(1200, false)
}

createButton("stopTrackingVerified") {
Radar.stopTrackingVerified()
}

createButton("getVerifiedLocationToken") {
Radar.getVerifiedLocationToken { status, token ->
Log.v("example", "GetVerifiedLocationToken: status = $status; token = ${token?.toJson()}")
}
}

createButton("trackVerified") {
Radar.trackVerified(false) { status, token ->
Log.v("example", "TrackVerified: status = $status; token = ${token?.toJson()}")
}
}

createButton("setExpectedJurisdiction") {
Radar.setExpectedJurisdiction("US", "CA")
}
Expand All @@ -127,6 +147,10 @@ class MainActivity : AppCompatActivity() {
Radar.startTracking(options)
}

createButton("stopTracking") {
Radar.stopTracking()
}

createButton("getContext") {
Radar.getContext { status, location, context ->
Log.v(
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/main/java/io/radar/sdk/RadarVerificationManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ internal class RadarVerificationManager(

if (this.lastToken != null) {
this.lastToken?.let {
if (lastTokenElapsed < it.expiresIn) {
Radar.logger.d("Last token valid | lastToken.expiresIn = ${it.expiresIn}; lastTokenElapsed = $lastTokenElapsed")
if (lastTokenElapsed < it.expiresIn && it.passed) {
Radar.logger.d("Last token valid | lastToken.expiresIn = ${it.expiresIn}; lastTokenElapsed = $lastTokenElapsed; lastToken.passed = ${it.passed}")

Radar.flushLogs()

Expand All @@ -366,7 +366,7 @@ internal class RadarVerificationManager(
return
}

Radar.logger.d("Last token invalid | lastToken.expiresIn = ${it.expiresIn}; lastTokenElapsed = $lastTokenElapsed")
Radar.logger.d("Last token invalid | lastToken.expiresIn = ${it.expiresIn}; lastTokenElapsed = $lastTokenElapsed; lastToken.passed = ${it.passed}")
}
} else {
Radar.logger.d("No last token")
Expand Down

0 comments on commit 8d7dfd9

Please sign in to comment.