Skip to content

Commit f371d8a

Browse files
authored
Update verify script for Android (#665)
* Update verify script * Add timeout for failure case * Fix build * Adding CaptureSdkConfig generation * Revert "Adding CaptureSdkConfig generation" This reverts commit fdfd844.
1 parent 9cdf121 commit f371d8a

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

ci/verify_android.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ adb uninstall io.bitdrift.capture.helloworld || true
66
adb install android_app.apk
77
adb shell am start -n io.bitdrift.capture.helloworld/.MainActivity
88

9-
while ! adb logcat -d | grep -q -e 'Capture Logger has been running for 15000 ms'; do
9+
timeout_seconds=30
10+
elapsed=0
11+
while ! adb logcat -d | grep -q -e 'Capture SDK properly initialized'; do
12+
if [ "$elapsed" -ge "$timeout_seconds" ]; then
13+
echo "Timeout after ${timeout_seconds}s waiting for Capture SDK init log"
14+
exit 1
15+
fi
1016
sleep 1
17+
elapsed=$((elapsed + 1))
1118
done

examples/android/HelloWorldApp.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class HelloWorldApp : Application() {
5050
Log.v("HelloWorldApp", "Android Bitdrift app launched with session url=${Logger.sessionUrl}")
5151

5252
Handler(Looper.getMainLooper()).postDelayed({
53-
Log.i("HelloWorldApp", "Capture Logger has been running for $kLoggerRunningDurationThreshold ms")
53+
Log.i("HelloWorldApp", getCaptureSdkInitializedMessage())
5454
}, kLoggerRunningDurationThreshold)
5555
}
5656

@@ -61,4 +61,17 @@ class HelloWorldApp : Application() {
6161
ogHandler?.uncaughtException(thread, throwable)
6262
}
6363
}
64+
65+
private fun getCaptureSdkInitializedMessage():String{
66+
return if (Logger.sessionUrl != null) {
67+
SDK_STARTED_MESSAGE
68+
} else {
69+
SDK_NOT_STARTED_MESSAGE
70+
}
71+
}
72+
73+
private companion object {
74+
private const val SDK_STARTED_MESSAGE = "Capture SDK properly initialized"
75+
private const val SDK_NOT_STARTED_MESSAGE = "Capture SDK not started yet"
76+
}
6477
}

0 commit comments

Comments
 (0)