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:

📘

Note

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

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 authentication

🚧

Important

The Face authentication action type will soon be fully deprecated in level configurations within the SDK.

  • To use Liveness as an action in your verification process, you need to configure a Selfie → Advanced Liveness check step for the regular Applicant actions level. New actions will run using this level, while existing actions created under the previous configuration will continue to work. To learn how to set up an Applicant actions level, refer to this article.
  • For Mobile SDK, the optional handler for receiving the Face authentication action result will be removed as part of the deprecation of this action type. Use the standard SDK flow instead — Additional verification with Liveness relies on the same callbacks, such as Pending, Temporary Declined, Finally Rejected, Approved, and so on. For more details, see the MobileSDK section.

Face authentication actions are handled in a specific manner. The user is taken directly to 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();
    }
};

Handle Face authentication action result

An optional handler for getting liveness results and controlling action scenario (for Face authentication 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 and so on).
  • 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();