Skip to content

Mobile SDK PoC

In order to make a fast PoC check the following points.

1. Installation and initial Setup

Add the SDK dependency to your proyect, and setup your IDLE as follows

repositories {
    mavenCentral()
    maven {
        url  "https://alicebiometrics.jfrog.io/artifactory/alicebiometrics-maven-pro-local/" 
    }
}

Add the following code yo your podfile.

pod 'AliceOnboarding'
Install it with

pod repo update
pod install

Import your library

import AliceOnboarding

2. Permissions

Alice Onboarding needs guaranteed camera permissions in order to function properly.

<uses-permission android:name="android.permission.CAMERA" />

Camera Permission is mandatory

Please check the Apple Documentation

3. Authentication

For trial purposes you will be able to test AliceOnboarding with the trial token available in your Credential's section of the Dashboard The TrialAuthenticator service will use the input email as unique identifyer.

An email parameter in UserInfo is required to associate it to an Alice Onboarding user_id

val trialToken = "<ADD-YOUR-TRIAL-TOKEN-HERE>"
val userInfo = UserInfo(email = email, // required
                        firstName = firstName, // optional 
                        lastName = lastName)  // optional 

val authenticator = TrialAuthenticator(trialToken = trialToken, userInfo = userInfo)

authenticator.execute { response ->
    when (response) {
        is Response.Success -> {
        // Configure Alice Onboarding with the OnboardingConfig
        // Then Run the Alice Onboarding Flow
        // The userToken is contained on the response.message
        }
        is Response.Failure -> {
        // Inform the user about Authentication Errors
        }
    }
}
let trialToken = "<ADD-YOUR-TRIAL-TOKEN-HERE>"
let userInfo = UserInfo(email: email, // required
                    firstName: firstName, // optional 
                    lastName: lastName)  // optional 

let authenticator = TrialAuthenticator(trialToken: trialToken, userInfo: userInfo)

authenticator.execute { result in
    switch result {
    case .success(let userToken):
        // Configure Alice Onboarding with the OnboardingConfig
        // Then Run the Alice Onboarding Flow
    case .failure(let error):
        // Inform the user about Authentication Errors
    }
}

4. Config your Alice Onboarding

You can configure the Onboarding for requesting different types of documents, selfies, etc...

Following you can find a snippet with an example.

val userToken = "<ADD-YOUR-USER-TOKEN-HERE>"

val config = OnboardingConfig.builder()
    .withUserToken(userToken)
    .withAddSelfieStage()
    .withAddDocumentStage(type = DocumentType.IDCARD, issuingCountry = "ESP")
    .withAddDocumentStage(type = DocumentType.DRIVERLICENSE, issuingCountry = "ESP")
    .withAddOtherTrustedDocumentStage(title = "Proof of address")
    config = try! config.withAddSelfieStage()
    config = try! config.withAddDocumentStage(
        ofType: .idcard,
        issuingCountry: "ESP",
        documentStageConfig: documentStageConfig
    )
    config = try! config.withAddDocumentStage(
        ofType: .driverlicense,
        issuingCountry: "ESP",
        documentStageConfig: documentStageConfig
    )

5. Run Alice Onboarding

Once you configured the Alice Onboarding Flow, you can run the process as follows

val onboarding = Onboarding(this, config = config)
    onboarding.run(ONBOARDING_REQUEST_CODE)
    }
}

...

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
        if (requestCode == ONBOARDING_REQUEST_CODE) {
            if (resultCode == Activity.RESULT_OK) {
                val userInfo = data!!.getStringExtra("userStatus")
        } else if (resultCode == Activity.RESULT_CANCELED) {

        }
    }
}
let onboarding = Onboarding(self, config: config)
onboarding.run { result in
    switch result {
    case let .success(userStatus):
        print("userStatus: \(String(describing: userStatus))")
    case let .failure(error):
        print("failure: \(error.localizedDescription)")
    case .cancel:
        print("User has cancelled the onboarding")
    }
}