Actions in Android SDK

Learn how to use applicant actions in Android SDK.

To run the Android SDK in applicant actions mode, you need to have:

  1. A verification level with Applicant actions. For more information on how to create such a level, see this article.
  2. An Access Token created with the userId, levelName, and externalActionId parameters.

Aside from the notes above, use the SDK the same way that you do with regular levels (see Initialization). Further processing, however, may differ depending on the action type.

The action type can be one of the following:

When using applicant actions, use the additional state for handling action results.

Additional Verification

Additional verification actions are processed identically to regular levels. You configure and manage the SDK the same way; nothing special is required.

🚧

Important

The Payment methods step is not supported at the moment.

Face Auth

Face authentication actions are handled in a specific manner. The user is taken directly on the FaceScan (Liveness) screen and once the action is complete, the SDK will be closed automatically.

val onSDKStateChangedHandler: (SNSSDKState, SNSSDKState) -> Unit = { newState, prevState ->
    Timber.d("onSDKStateChangedHandler: $prevState -> $newState")

    // Face auth flow has been completed
    if (newState is SNSSDKState.ActionCompleted) {
        val actionId = newState.actionId
        val type = newState.type
        val answer = newState.answer
        val payload = newState.payload
    }
}
SNSStateChangedHandler stateChangedHandler = (previousState, currentState) -> {

    Timber.d("The SDK state was changed: " + previousState + " -> " + currentState);

    if (currentState instanceof SNSSDKState.ActionCompleted) {
        SNSSDKState.ActionCompleted actionState = (SNSSDKState.ActionCompleted) currentState;
        String actionId = actionState.getActionId();
        FlowActionType type = actionState.getType();
        String answer = actionState.getAnswer();
        Map<String, Object> payload = actionState.getPayload();
    }
};

On action result

An optional handler for getting liveness results and controlling action scenario (for Face Auth action only).

The handler takes two parameters:

  • actionId : String — Action ID.
  • answer : String — Liveness module answer. Possible values: "GREEN", "YELLOW", "RED", "ERROR" or null.

The handler must return SNSActionResult. Currently the following values are supported:

  • SNSActionResult.Continue — continue default action scenario (show the result screen etc.).
  • SNSActionResult.Cancel — cancel default action scenario (close the SDK without the result screen).
val onActionResultHandler: SNSActionResultHandler = object : SNSActionResultHandler {
   override fun onActionResult(actionId: String, actionType: String, answer: String?, allowContinuing: Boolean): SNSActionResult {
       Timber.d("Face Auth action result: actionId: $actionId answer: $answer")
       // use default scenario
       return SNSActionResult.Continue
   }
}
val snsSdkBuilder = SNSMobileSDK.Builder(this).withActionResultHandler(onActionResult)
SNSActionResultHandler actionResultHandler = (actionId, actionType, answer, allowContinuing) -> {
    Timber.d("Action Result: actionId: " + actionId + ", answer: " + answer);
    return SNSActionResult.Continue;
};

SNSMobileSDK.SDK snsSdk = new SNSMobileSDK.Builder(requireActivity()).withActionResultHandler(actionResultHandler).build();