From 8d7dfd9efe528dacb7429bcfdfe612249e318180 Mon Sep 17 00:00:00 2001 From: Nick Patrick Date: Tue, 22 Oct 2024 07:58:11 -0400 Subject: [PATCH] add buttons to example app, add passed check in getVerifiedLocationToken() --- .../java/io/radar/example/MainActivity.kt | 26 ++++++++++++++++++- .../io/radar/sdk/RadarVerificationManager.kt | 6 ++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/example/src/main/java/io/radar/example/MainActivity.kt b/example/src/main/java/io/radar/example/MainActivity.kt index aaf68693..728a7503 100644 --- a/example/src/main/java/io/radar/example/MainActivity.kt +++ b/example/src/main/java/io/radar/example/MainActivity.kt @@ -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() { @@ -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") } @@ -127,6 +147,10 @@ class MainActivity : AppCompatActivity() { Radar.startTracking(options) } + createButton("stopTracking") { + Radar.stopTracking() + } + createButton("getContext") { Radar.getContext { status, location, context -> Log.v( diff --git a/sdk/src/main/java/io/radar/sdk/RadarVerificationManager.kt b/sdk/src/main/java/io/radar/sdk/RadarVerificationManager.kt index 560413e2..759e3723 100644 --- a/sdk/src/main/java/io/radar/sdk/RadarVerificationManager.kt +++ b/sdk/src/main/java/io/radar/sdk/RadarVerificationManager.kt @@ -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() @@ -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")