Skip to Content
Docs
Get startedPartner API v4Partner API v3Android SDK
v1.0.9

Mode 3 – Docked Button

Like Mode 1 but each SDK screen shows a persistent button at the bottom that you define. The button's onClick lambda receives the SDK screen's Context – use it to start your own Activity or chain directly to the next SDK method.

The docked button is scoped to the single screen it was passed for. It is read once when the screen opens. Passing null shows no button.

New in v1.0.9 – isGenerateReport flag

  • Starts disabled – the button is disabled until at least one recording exists and no active recording is in progress.
  • Confirmation dialog – tapping the button shows a dialog that lists any pending uploads per section, with Generate and Cancel options.
  • Locks after success – once the report is triggered, the button disables again and new recordings are blocked.
  • State persists – the locked state survives process death; the SDK reads reportGenerated from the local DB on next launch.
// Audio screen with an isGenerateReport docked button.
// The SDK handles enabled/disabled state, the confirmation dialog,
// and locking recordings automatically – no extra code needed.
AbleCredit.recordAudio(
    context       = this,
    loanReference = loanReference,
    dockedButton  = AbleCreditDockedButton(
        label           = "Generate Report",
        isGenerateReport = true,
        onClick         = { context ->
            // onClick still fires when the user confirms in the dialog.
            // You can navigate to a completion screen here, or leave empty.
            context.startActivity(Intent(context, ReportSuccessActivity::class.java))
        }
    )
)

// Without isGenerateReport (existing v1.0.8 pattern – still works):
AbleCredit.recordAudio(
    context       = this,
    loanReference = loanReference,
    dockedButton  = AbleCreditDockedButton(
        label  = "Generate Report",
        onClick = { context ->
            // You own the confirmation and the requestReportGeneration call.
            AbleCredit.requestReportGeneration(context, loanReference) { result ->
                when (result) {
                    is AbleCreditResult.Success ->
                        context.startActivity(Intent(context, ReportSuccessActivity::class.java))
                    is AbleCreditResult.Failure -> { /* handle */ }
                }
            }
        }
    )
)

Example – Audio → Your review screen → Photos → Report

// Audio screen → navigate to your own review screen on tap
AbleCredit.recordAudio(
    context           = this,
    loanApplicationId = applicationId,
    listener          = object : AbleCreditFileUploadListener {
        override fun onStatusChanged(uniqueId: String, status: AbleCreditFileStatus, message: String?) {
            when (status) {
                AbleCreditFileStatus.UPLOADED -> myStore.markUploaded(uniqueId)
                AbleCreditFileStatus.FAILED   -> myStore.markFailed(uniqueId, message)
                else -> {}
            }
        }
    },
    dockedButton = AbleCreditDockedButton(
        label  = "Done – Review Recordings",
        onClick = { context ->
            context.startActivity(
                Intent(context, AudioReviewActivity::class.java)
                    .putExtra("applicationId", applicationId)
            )
        }
    )
)

// Business photos → chain to next SDK method directly
AbleCredit.captureBusinessPhotos(
    context           = this,
    loanApplicationId = applicationId,
    dockedButton      = AbleCreditDockedButton(
        label  = "Next – Family Photos",
        onClick = { context ->
            AbleCredit.captureFamilyPhotos(context, applicationId)
        }
    )
)

// Last screen → trigger report on tap
AbleCredit.captureFamilyPhotos(
    context           = this,
    loanApplicationId = applicationId,
    dockedButton      = AbleCreditDockedButton(
        label  = "Generate Report",
        onClick = { context ->
            AbleCredit.requestReportGeneration(context, applicationId) { result ->
                when (result) {
                    is AbleCreditResult.Success ->
                        context.startActivity(Intent(context, DoneActivity::class.java))
                    is AbleCreditResult.Failure -> { /* handle */ }
                }
            }
        }
    )
)

On this page