Skip to main content

Onboarding

The SDK provides 2 optional onboarding possibilities that will be shown to the user on first start with some default content. It can be disabled if you do not want to use it. You can also alter the contents of the onboarding to adapt it to your needs.

Full Screen View Pager​

The first option provides a full screen view pager with swipeable content that opens once before the camera starts.

By default, this option is deactivated on the document scan and activated on the photo payment process.

onboardingDataProtection onboardingLightingConditions

Scan Hint Popup​

The second option is a popup on the scanning screen.

By default, this option is activated on document scan and on photo payment.

onboardingScanHintPopup

Customize​

Button colors are configured by the global color configuration.

Onboarding​

You can use the onboarding option as part of the document scan or photo payment process to alter the default onboarding behaviour to your needs. Currently the following values can be set:

PropertyTypeDescription
itemsList<DocutainListItem>?The items you want to show within the onboarding. If you don't provide any items, some default items will be displayed in case of photo payment. In case of document scan, onboarding won't be shown.
buttonNextDocutainButtonThe button that goes to the next item.
buttonFinishDocutainButtonThe button that closes the onboarding on the last item.
buttonSkipDocutainButtonThe button to skip (close) the onboarding.
buttonBackDocutainButton?The button that goes to the previous item. It is disabled by default.
scanHintPopupScanHintPopup?A popup that appears when scan is opened for the first time, explaining to the user how to scan. See ScanHintPopup for more details.

You can use a selection of the SDK's default items. For example, to show only the first default onboarding page:

val onboarding = Onboarding().apply {
items = DocutainSdk.onboardingDefaultItems().take(1)
}

val scanConfig = DocumentScannerConfiguration().apply {
this.onboarding = onboarding
}

val scope = rememberCoroutineScope()
scope.launch {
val result = DocutainSdk.scanDocument(scanConfig)
}

The following sample alters the buttonNext title.

val onboarding = Onboarding().apply {
items = DocutainSdk.onboardingDefaultItems()
buttonNext.title = "my next"
}
val scanConfig = DocumentScannerConfiguration().apply {
this.onboarding = onboarding
}
val scope = rememberCoroutineScope()
scope.launch {
DocutainSdk.scanDocument(scanConfig)
}

ScanHintPopup​

The following provides an overview of the currently available common options to alter the ScanHintPopup:

PropertyTypeDescription
titleString?The text to display as title.
messageString?The text to display as message.
closeButtonString?The text of the close button.
val onboarding = Onboarding().apply {
scanHintPopup = ScanHintPopup().apply {
title = "Scan your document"
message = "Hold the device steady and fit the full page into the frame."
closeButton = "Got it"
}
}
val scanConfig = DocumentScannerConfiguration().apply {
this.onboarding = onboarding
}
val scope = rememberCoroutineScope()
scope.launch {
DocutainSdk.scanDocument(scanConfig)
}

Disable​

If you don't want to use either onboarding option, set the onboarding property to null.

val scanConfig = DocumentScannerConfiguration().apply {
onboarding = null
}
val scope = rememberCoroutineScope()
scope.launch {
val result = DocutainSdk.scanDocument(scanConfig)
}

If you want to use the swipeable onboarding, but not the popup, set the scanHintPopup property to null.

val onboarding = Onboarding().apply {
items = DocutainSdk.onboardingDefaultItems()
scanHintPopup = null
}
val scanConfig = DocumentScannerConfiguration().apply {
this.onboarding = onboarding
}
val scope = rememberCoroutineScope()
scope.launch {
DocutainSdk.scanDocument(scanConfig)
}

If you want to use the popup for Photo Payment, but not the swipeable onboarding, set the items property to an empty list. For document scan, this is the default option.

val onboarding = Onboarding().apply {
items = emptyList()
}
val photoPaymentConfig = PhotoPaymentConfiguration().apply {
this.onboarding = onboarding
}
val scope = rememberCoroutineScope()
scope.launch {
DocutainSdk.startPhotoPayment(photoPaymentConfig)
}

Reset​

Both onboarding options are shown only once. If you want to show them again, you can use the resetOnboarding method. You can choose which one you want to reset:

DocutainSdk.resetOnboarding(
onboarding = true,
scanHintPopup = true
)