SDK reference · Android SDK / Android Common Implementation Patterns

Run Flows Configured in Dashboard

This integration pattern for the Android SDK uses the Workflows API. The Workflows API runs onboarding flows defined in Dashboard instead of in your app. It uses modules and configurations you set up in Dashboard, so you don't need to define flows locally through FlowConfig.Builder. You can change a Workflow's configuration in Dashboard without modifying your code.

Unlike local patterns, where you assemble the flow and configure each module in code, flow content is configured in Dashboard. The modules included in the flow and their settings come from the activated Workflow. Your app only needs to reference it by ID.

This page covers session creation and section execution only. Ensure you have followed the steps to Install and Initialize the Incode Android SDK first.

For the modules a Workflow can include, see Individual Modules. For instructions on configuring Workflows in Dashboard, see Configure Workflows.


Set Up This Integration Pattern

Complete the following steps in order.

Create a Callback to Receive SDK Results

Implement an OnboardingListener to receive results from the Workflow's modules and the overall flow:

val onboardingListener: OnboardingListener = object : OnboardingListener() {
    override fun onOnboardingSessionCreated(token: String?, interviewId: String?, region: String) {
        // Onboarding Session Created successfully
    }

    override fun onIntroCompleted() {
        // Intro screen completed
    }

    override fun onAddPhoneCompleted(phoneNumberResult: PhoneNumberResult) {
        // Add phone completed
    }

    override fun onQRScanCompleted(qrScanResult: QRScanResult) {
        // QR scan completed
    }

    override fun onIdFrontCompleted(frontIdScanResult: IdScanResult) {
        // Scanning the front of an ID completed
    }

    override fun onIdBackCompleted(backIdScanResult: IdScanResult) {
        // Scanning the back of an ID completed
    }

    override fun onIdProcessed(idProcessResult: IdProcessResult) {
        // ID Validation completed
    }

    override fun onNfcScanCompleted(nfcScanResult: NfcScanResult) {
        // NFC scan completed
    }

    override fun onDocumentValidationCompleted(
        documentType: DocumentType,
        result: DocumentValidationResult
    ) {
        // Document validation completed
    }

    override fun onSelfieScanCompleted(selfieScanResult: SelfieScanResult) {
        // Selfie scan completed
    }

    override fun onFaceMatchCompleted(faceMatchResult: FaceMatchResult) {
        // Face match completed
    }

    override fun onSignatureCollected(signatureFormResult: SignatureFormResult) {
        // Signature collected
    }

    override fun onUserConsentCompleted() {
        // User consent complete
    }

    override fun onVideoRecorded(videoSelfieResult: VideoSelfieResult) {
        // Video selfie finished successfully
    }

    override fun onCaptchaCollected(captchaResult: CaptchaResult) {
        // Captcha collected
    }

    override fun onGeolocationFetched(geolocationResult: GeolocationResult) {
        // Geolocation collected
    }

    override fun onApproveCompleted(approveResult: ApproveResult) {
        // User's onboarding approval completed
    }

    override fun onResultsShown(userScoreResult: UserScoreResult) {
        // Results shown to the user
    }

    override fun onQueuePositionChanged(newQueuePosition: Int) {
        // Queue position for the video call changed
    }

    override fun onEstimatedWaitingTime(waitingTimeInSeconds: Int) {
        // Called only once with the estimated waiting time in the queue. Waiting time is in seconds.
    }

    override fun onConferenceEnded() {
        // Called when the video conference has ended
    }

    override fun onSuccess() {
        // User successfully finished whole onboarding flow
    }

    override fun onError(error: Throwable) {
        // Onboarding flow was aborted due to error
    }

    override fun onUserCancelled() {
        // User cancelled the flow
    }
}
OnboardingListener onboardingListener = new IncodeWelcome.OnboardingListener() {
    @Override
    public void onOnboardingSessionCreated(@Nullable String token, @Nullable String interviewId, @NonNull String region) {
        // Onboarding Session Created successfully
    }

    @Override
    public void onIntroCompleted() {
        // Intro screen completed
    }

    @Override
    public void onAddPhoneCompleted(@NonNull PhoneNumberResult phoneNumberResult) {
        // Add phone completed
    }

    @Override
    public void onQRScanCompleted(@NonNull QRScanResult qrScanResult) {
        // QR scan completed
    }

    @Override
    public void onIdFrontCompleted(@NonNull IdScanResult frontIdScanResult) {
        // Scanning the front of an ID completed
    }

    @Override
    public void onIdBackCompleted(@NonNull IdScanResult backIdScanResult) {
        // Scanning the back of an ID completed
    }

    @Override
    public void onIdProcessed(@NonNull IdProcessResult idProcessResult) {
        // ID Validation completed
    }

    @Override
    public void onNfcScanCompleted(@NonNull NfcScanResult nfcScanResult) {
        // NFC scan completed
    }

    @Override
    public void onDocumentValidationCompleted(@NonNull DocumentType documentType, @NonNull DocumentValidationResult result) {
        // Document validation completed
    }

    @Override
    public void onSelfieScanCompleted(@NonNull SelfieScanResult selfieScanResult) {
        // Selfie scan completed
    }

    @Override
    public void onFaceMatchCompleted(@NonNull FaceMatchResult faceMatchResult) {
        // Face match completed
    }

    @Override
    public void onSignatureCollected(@NonNull SignatureFormResult signatureFormResult) {
        // Signature collected
    }

    @Override
    public void onUserConsentCompleted() {
        // User consent complete
    }

    @Override
    public void onVideoRecorded(@NonNull VideoSelfieResult videoSelfieResult) {
        // Video selfie finished successfully
    }

    @Override
    public void onCaptchaCollected(@NonNull CaptchaResult captchaResult) {
        // Captcha collected
    }

    @Override
    public void onGeolocationFetched(@NonNull GeolocationResult geolocationResult) {
        // Geolocation collected
    }

    @Override
    public void onApproveCompleted(@NonNull ApproveResult approveResult) {
        // User's onboarding approval completed
    }

    @Override
    public void onResultsShown(@NonNull UserScoreResult userScoreResult) {
        // Results shown to the user
    }

    @Override
    public void onQueuePositionChanged(int newQueuePosition) {
        // Queue position for the video call changed
    }

    @Override
    public void onEstimatedWaitingTime(int waitingTimeInSeconds) {
        // Called only once with the estimated waiting time in the queue. Waiting time is in seconds.
    }

    @Override
    public void onConferenceEnded() {
        // Called when the video conference has ended
    }

    @Override
    public void onSuccess() {
        // User successfully finished whole onboarding flow
    }

    @Override
    public void onError(@NonNull Throwable error) {
        // Onboarding flow was aborted due to error
    }

    @Override
    public void onUserCancelled() {
        // User cancelled the flow
    }
};

For the shape and fields of each result object, see Results.

The SDK has multiple exit paths. Call IncodeWelcome.deleteUserLocalData(context) after the flow ends to delete all local user data. This is a static method that takes a Context. Call deleteUserLocalData() in these callbacks:

fun onSuccess()
fun onError(error: Throwable)
fun onUserCancelled()
public void onSuccess()
public void onError(Throwable error)
public void onUserCancelled()

Create the Session Configuration

Use the SessionConfig.Builder API setConfigurationId() to specify the Workflow ID from Dashboard. This tells the SDK which modules and configuration to use. Ensure the Workflow is activated in Dashboard before starting the session.

val sessionConfig = SessionConfig.Builder()
    .setConfigurationId(workflowId)
    .build()
SessionConfig sessionConfig = new SessionConfig.Builder()
    .setConfigurationId(workflowId)
    .build();

Start the Onboarding Session

Start the session using the one of the following:

  • startWorkflow() runs the modules defined for the Workflow in Dashboard and reports progress and results through the onboardingListener.
    IncodeWelcome.getInstance().startWorkflow(
        activityContext,
        sessionConfig,
        onboardingListener)
    
    IncodeWelcome.getInstance().startWorkflow(
        activityContext,
        sessionConfig,
        onboardingListener);
    
  • startFlow() runs the modules defined for the Flow in Dashboard and reports progress through the onboardingListener.
    IncodeWelcome.getInstance().startFlow(
        activityContext,
        sessionConfig,
        onboardingListener)
    
    IncodeWelcome.getInstance().startFlow(
        activityContext,
        sessionConfig,
        onboardingListener);
    

Was this page helpful?