Kotlin SDK
A native flow for Android 7.0 (API 24) and newer that collects the requested documents, runs the liveness challenge and location step, and sends the evidence for review.
sdk module as a Gradle project dependency. Imports use net.credflare.sdk.Add the guided flow
import net.credflare.sdk.CredflareVerification
import net.credflare.sdk.SessionDescriptor
import net.credflare.sdk.SessionProvider
import net.credflare.sdk.VerificationResult
CredflareVerification.launch(activity, SessionProvider {
SessionDescriptor.fromJson(yourBackend.createApplicantSession()) // runs on a worker thread
}) { result ->
when (result) {
VerificationResult.SUBMITTED -> refreshStatus()
VerificationResult.HOST_ACTION_REQUIRED -> showYourOwnSteps()
VerificationResult.CANCELLED -> Unit
VerificationResult.FAILED -> showRetry()
}
} The provider calls your own authenticated backend, which creates the session as shown in the server example. launch returns false when a flow is already open.
| Result | Meaning |
|---|---|
SUBMITTED | Nothing is left to collect. This is a receipt, not a decision. |
HOST_ACTION_REQUIRED | The SDK collected what it can, but the case still needs something your app handles: founders questions, checks the SDK does not collect, or a leave rejection. |
CANCELLED | The applicant closed the flow. The case stays open. |
FAILED | The flow could not start, for example because the provider threw. |
The flow collects the documents, then the questions, then the case's facial, location, email and phone requirements in profile order, then shows the receipt.
To learn which rejection the applicant left from, use launchWithOutcome. Its VerificationOutcome has the result and, after a leave rejection, the rejectionCode, such as phone.not_configured.
CredflareVerification.launchWithOutcome(activity, provider) { outcome ->
if (outcome.result == VerificationResult.HOST_ACTION_REQUIRED && outcome.rejectionCode != null) {
offerAnotherWay(outcome.rejectionCode)
}
} Liveness and location
- The facial step requests a liveness challenge, runs its gestures on the front camera, records a short video without sound when the profile asks for one, and takes the selfie. Frames, video and selfie are uploaded against the challenge, then submitted together.
- Face signals come from ML Kit face detection with the bundled model (
com.google.mlkit:face-detection16.1.7). is_mockis the Android mock flag:isMockon Android 12 and newer,isFromMockProviderbefore.- A
422raisesCredflareExceptionwith the rejection code incode. Compare it withCredflareSpec.ErrorCode.isKnownCodeis false for codes newer than the SDK. - Camera photos and liveness videos go to private temporary files. They are not saved to the photo library.
Questions and codes
- The questionnaire shows each question whose
show_ifmatches the answers above it. Hidden questions are not checked and not sent.QuestionnaireandConditionsapply the same rules to your own form. - The email and phone steps send a six digit code and confirm it. The new code button counts down to the time the server allows.
- After every submission and code confirmation, the flow fetches the session again and follows the refresh rule, including a
409when the last submission closed the case. Rejections.screen()returns the title, message, action and help line for a code from the rejection map. The help line uses the requester's help contact fromSessionInfo.help. Aresend_too_soonrejection also carriesresendAvailableAt.
Build your own screens
VerificationSession offers get(), upload(), createLivenessChallenge(), uploadBiometric(), submit(), submitFacial(), submitLocation(), requestCode(), confirmCode(), submitAnswers(), replaceSession() and cancel(). They block, so call them off the main thread. Uploads and submissions take a UUID retry key. Reuse the key with the same evidence after a network failure.
Configure the app
- Build with JDK 17 and an Android SDK with API 36.
- The SDK manifest merges
INTERNET,CAMERA,ACCESS_FINE_LOCATIONandACCESS_COARSE_LOCATIONinto your app. Camera and location are requested at runtime only when a step needs them.RECORD_AUDIOis not needed.
Read how the SDKs work for capture methods, receipts and error handling.