Trulioo Compatible Android Face capture SDK

Integration checklist

Library Dependencies
Libraries are provided as .aar files under Library_Modules. We recommend using Android Studio for your projects. All maven dependency versions are defined in the root level build.gradle of the provided sample app, and are referred to as "$dependencyVersion".

FacialCapture Core Module Dependencies

  • api-release
  • facialcapturecontroller-release
  • facialcapturescience-release
  • facialcaptureworkflow(-release)
  • imageutils-release
  • mibidata-release
  • misnapcamera-release

FacialCapture Core Maven Dependencies

  • androidx.appcompat:appcompat:$appcompatVersion
  • androidx.fragment:fragment:$fragmentVersion
  • androidx.constraintlayout:constraintlayout:$constraintlayoutVersion
  • com.google.android.material:material:$materialDesignVersion
  • androidx.localbroadcastmanager:localbroadcastmanager:$localbroadcastmanagerVersion
  • org.greenrobot:eventbus:$eventbusVersion
  • org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion
  • org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesVersion
  • org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlinSerializationVersion
  • org.apache.commons:commons-imaging:$commonsImagingVersion
  • com.google.mlkit:face-detection:$mlKitVersion

Integrating with existing MiSnap Install

To integrate with an existing MiSnap install, replace the following dependencies with the version included in the FacialCapture SDK:

  • api-release
  • imageutils-release
  • mibidata-release
  • misnapcamera-release

Starting the Workflow

The entry point into the FacialCapture SDK is the FacialCaptureWorkflowActivity

To start the FacialCapture workflow:

val facialCaptureParams = JSONObject().apply {
    // Custom settings can be added here
    put(/* Settings key */, /* Settings value */)
}
 
val intent = Intent(context, FacialCaptureWorkflowActivity::class.java).apply {
    putExtra(MiSnapApy.JOB_SETTINGS, facialCaptureParams.toString())
}
 
startActivityForResult(intent, MiSnapApi.RESULT_PICTURE_CODE)
// See MainActivity.java startFacialCaptureWorkflow() for additional sample code
// Exception catching removed for clarity
JSONObject facialCaptureParams = new JSONObject();
// Custom settings can be added here
facialCaptureParams.put(/* Settings key */, /* Settings value */);
 
Intent intent = new Intent(context, FacialCaptureWorkflowActivity.class);
intent.putExtra(MiSnapApi.JOB_SETTINGS, facialCaptureParams.toString());
startActivityForResult(intent, MiSnapApi.RESULT_PICTURE_CODE);
// See MainActivity.java startFacialCaptureWorkflow() for additional sample code

Retrieving the Results

Once FacialCapture has captured an image, it will return it as part of the return Intent from the activity. If the user manually captured an image, any detected quality issues will be returned as warnings.

To retrieve the results:

@override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    val facialCaptureResult = data?.getParceableExtra(FacialCaptureWorkflowApi.FACIAL_CAPTURE_RESULT) as? FacialCaptureResult
     
    facialCaptureResult?.let {
        val image = it.image
        val resultCode = it.resultCode
        val warnings = it.warnings
    }
}
// See MainActivity.java onActivityResult(),
// ResultsActivity.java onCreate() for additional sample code, and
// FacialCaptureResult class for the data returned by the SDK.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    ...
    FacialCaptureResult facialCaptureResult = (FacialCaptureResult) data.getParcelableExtra(FacialCaptureWorkflowApi.FACIAL_CAPTURE_RESULT)
    byte[] image = facialCaptureResult.getImage();
    String resultCode = facialCaptureResult.getResultCode();
    List<String> warnings = facialCaptureResult.getWarnings();
}
// See MainActivity.java onActivityResult(),
// ResultsActivity.java onCreate() for additional sample code, and
// FacialCaptureResult class for the data returned by the SDK.