Install
How to install the Kotlin Multiplatform SDK in your app?โ
The Screeb KMP SDK supports Android and iOS targets. It wraps the native Screeb Android and iOS SDKs behind a Kotlin Multiplatform API.
Screeb adds about 110 KB on Android and about 450 KB on iOS release apps.
See the example to install the latest version of the Screeb SDK dependency in a Kotlin Multiplatform app.
Technical requirementsโ
- Kotlin 2.1.0 or higher
- Android minSdk 21 or higher
- iOS 14 or higher
Add Screeb as a dependencyโ
Add the SDK to your commonMain dependencies:
commonMain.dependencies {
implementation("app.screeb.sdk.kmp:screeb-kmp:x.x.x")
}
Initialize the SDKโ
tip
You can find your channel id in your workspace settings.
import app.screeb.sdk.kmp.Screeb
import app.screeb.sdk.kmp.ScreebInitOptions
Screeb.initSdk(
channelId = "<YOUR_CHANNEL_ID>",
userId = "user_123",
properties = mapOf("plan" to "pro"),
initOptions = ScreebInitOptions(isDebugMode = false),
)
About SDK lifecycleโ
At any time, you can stop the Screeb SDK with:
Screeb.closeSdk()
Hooks supportโ
Hook callbacks are supported on Android and iOS. You can pass ScreebHooks to initSdk, startSurvey, or startMessage.
import app.screeb.sdk.kmp.ScreebHooks
Screeb.initSdk(
channelId = "<YOUR_CHANNEL_ID>",
hooks = ScreebHooks(
version = "1.0.0",
callbacks = mapOf(
"onSurveyShowed" to { payload ->
println("Survey shown: $payload")
null
},
"onSurveyDisplayAllowed" to { payload ->
println("Display allowed: $payload")
true
},
),
),
)