Skip to main content

Incode Welcome Capture SDK Usage

Features​

Suppoted modules: ID/Passport capture, Selfie capture, Document capture and Video Selfie.

APIs perform local checks and auto-capture the photo when conditions are met.

Returns the captured photo through a callback.

API calls are completely decoupled (can be called in any order and any number of times).

Doesn't perform any network operations.

1. Initialize Welcome SDK​

Let's get started by initializing the Welcome SDK!

Add the following line of code to your class that extends the MultidexApplication class:

@Override
public void onCreate() {
super.onCreate();
...
new IncodeWelcome.Builder(this)
.setLoggingEnabled(loggingEnabled) // enable/disable logcat logs. logs are enabled by default
.setSdkMode(SdkMode.CAPTURE_ONLY) // enable CAPTURE_ONLY mode
.build();
...
}

Let's take a look at what is happening in this code:

  • We create an IncodeWelcome object using the Builder class and build() method.
  • Make sure to set SDK mode to SdkMode.CAPTURE_ONLY.
  • Optionally disable logs.
  • Call the build() method to create the IncodeWelcome singleton object.
  • You can use the following API calls only after the SDK has been initialized using the build().

Review the API Javadoc for complete specification of IncodeWelcome.Builder class.

2. Perform capture SDK calls​

// IdScan

IncodeWelcome.getInstance().setSdkMode(com.incode.welcome_sdk.SdkMode.CAPTURE_ONLY);
try {
IdScan idScan = new IdScan.Builder()
.setShowIdTutorials(true)
.build();

FlowConfig flowConfig = new FlowConfig.Builder()
.setFlowTag("ID scan section")
.addID(idScan)
.build();

IncodeWelcome.getInstance()
.startOnboardingSection(this, flowConfig, new IncodeWelcome.OnboardingListener() {
@Override
public void onIdProcessed(IdProcessResult idProcessResult) {
// Use idProcessResult to read the result photos
}

@Override
public void onError(Throwable error) {}

@Override
public void onUserCancelled() {}

@Override
public void onOnboardingSectionCompleted(String flowTag) {
// ID scan section complete
}
}
);
} catch (ModuleConfigurationException e) {
e.printStackTrace();
}

// SelfieScan

IncodeWelcome.getInstance().setSdkMode(com.incode.welcome_sdk.SdkMode.CAPTURE_ONLY);
try {
SelfieScan selfieScan = new SelfieScan.Builder()
.setShowTutorials(true)
.build();

FlowConfig flowConfig = new FlowConfig.Builder()
.setFlowTag("Selfie scan section")
.addSelfieScan(selfieScan)
.build();

IncodeWelcome.getInstance()
.startOnboardingSection(this, flowConfig, new IncodeWelcome.OnboardingListener() {
@Override
public void onSelfieScanCompleted(SelfieScanResult selfieScanResult) {
// Use selfieScanResult to read the result photo
}

@Override
public void onError(Throwable error) {}

@Override
public void onUserCancelled() {}

@Override
public void onOnboardingSectionCompleted(String flowTag) {
// Selfie scan section complete
}
}
);
} catch (ModuleConfigurationException e) {
e.printStackTrace();
}

3. Important: Call deleteUserLocalData() when you're done​

Because the Incode SDK has multiple ways to exit the flow, make sure to call IncodeWelcome.getInstance().deleteUserLocalData() to delete all the local user data generated during the flow when you are done.

It is recommended to call deleteUserLocalData() in the following callbacks:

public void onSuccess()
public void onError()
public void onUserCancelled()