In-App Surveys Callbacks

Survey callbacks and flows (onShow, onDismiss, handlers) in KMP.

Flows

When a survey is shown:

Kotlin
scope.launch {
    SurveysKmp.onShow.collect {
        // Survey UI is about to be shown
    }
}

When a survey is dismissed:

Kotlin
scope.launch {
    SurveysKmp.onDismiss.collect {
        // Survey UI was dismissed
    }
}

Handlers (convenience)

For simple callbacks on the UI thread, you can use handlers instead of collecting the flows:

Kotlin
SurveysKmp.setOnShowHandler {
    // Called before survey UI is presented
}
SurveysKmp.setOnDismissHandler {
    // Called after survey UI is dismissed
}

For more control (e.g. coroutine context), use the onShow and onDismiss flows.

Last updated