Examples
Practical, task-based code snippets for the Android SDK.
Basic setupโ
Initialize Screeb once, typically in your Application.onCreate():
Screeb.initSdk(
this,
"<YOUR-CHANNEL-ID>",
)
If the user is already authenticated when the app starts, pass their identity directly:
Screeb.setIdentity(
"user-123",
TrackingEventProperties().apply {
this["email"] = "support@screeb.app"
this["plan"] = "pro"
}
)
Track an eventโ
Screeb.trackEvent("Product added to cart")
Track a screenโ
Screeb.trackScreen("Checkout")
Start a surveyโ
Screeb.startSurvey(surveyId = "<SURVEY-ID>")
Assign a groupโ
Screeb.assignGroup(name = "acme-corp", type = "company")
Debug the current stateโ
Screeb.debug { payload, error -> Log.d("Screeb", payload) }
Screeb.debugTargeting { payload, error -> Log.d("Screeb", payload) }
Reset on logoutโ
Screeb.resetIdentity()
tip
Runnable reference code for these calls lives in the SDK's internal demo app, under app/src/main/java/app/screeb/application/ui/home/HomeFragment.kt.