Liveness Component (Beta) – GBG IDscan Documentation

Liveness Component (Beta)

This is beta version of on-device liveness:

  • The interface can change depending on customer responses.
  • Check release notes and Q/A section or ask technical account manager (supportcase@idscan.com) for known issues.
  • The size should be smaller in non-beta releases.

This component is needed for detecting liveness and provides:

  1. Aggregated result
  2. Audit Trail
  3. Images to be used for Face Match

Add Maven library’s (Your account needs to have granted access):

Java

// Combined Core and Model
implementation 'com.idscan.idfb:liveness-core:0.4.6.4'

Note: This adds around ~24mb depending on version. We are working on optimising this.

This size is separated to 17mb + per architecture 3mb + dependencies.

  • Example of armeabi-v7a build in total increases around ~22mb APK
  • Example of armeabi-v7a + arm64-v8a build in total increases around ~24mb APK Add to your layout (We recommend using full screen):
<FrameLayout
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent">
</FrameLayout>

Implement liveness listener:

Java

private LivenessFragment.LivenessListener livenessListener = new LivenessFragment.LivenessListener() {

	// Will return final result @Override
	public void onAggregatedResult(AggregatedResult result) {}

	// Will return each action final result. @Override
	public void onActionEventAudit(ActionResultState auditTrail) {}

	// Will return images dedicated for Face Match result.
	// Use this images for first upload as they are dedicated straight looking images. @Override
	public void onNewImage(Bitmap bitmap) {}

	// Will return on error object of Scanner @Override
	public void (ScannerError livenessError) {}
};

Kotlin

private val livenessListener = object : LivenessFragment.LivenessListener {
        override fun onAggregatedResult(result: AggregatedResult) {
            // Aggregated result liveness result.
        }
 
        override fun onActionEventAudit(audit: ActionResultState) {}
 
        override fun onNewImage(bitmap: Bitmap) {
            // Image for FaceMatching
        }
 
        override fun onError(livenessError: ScannerError) {
            // Error handling
        }
    }

Initialise Liveness fragment.

Java

LivenessFragment livenessFragment = new LivenessFragment();
livenessFragment.setLivenessListener(livenessListener);
 
// You will receive values from server, liveness call.
Configuration configuration = new Configuration(
    // Map this values from ResponseUpload -> EntryData object
    LivenessKeys.KEY_IEOS_LIVENESS_TIME_OUT,
    LivenessKeys.KEY_IEOS_LIVENESS_ACTION_COUNT,
    LivenessKeys.KEY_IEOS_LIVENESS_FRAMES_COUNT,
    LivenessKeys.KEY_IEOS_LIVENESS_MAX_FAILED_ATTEMPTS);
livenessFragment.setConfiguration(configuration);
getSupportFragmentManager().beginTransaction().add(R.id.root, livenessFragment).commit();

Kotlin

val configuration = Configuration(
	KEY_IEOS_LIVENESS_TIME_OUT, 
	KEY_IEOS_LIVENESS_ACTION_COUNT, 
	KEY_IEOS_LIVENESS_FRAMES_COUNT, 	
	KEY_IEOS_LIVENESS_MAX_FAILED_ATTEMPTS
)
val livenessFragment = LivenessFragment() livenessFragment.setConfiguration(configuration) livenessFragment.setLivenessListener(livenessListener) supportFragmentManager.beginTransaction()
	.replace(R.id.container, livenessFragment, LIVENESS)
	.commit()

Keys for retrieving configuration values from ResponseUpload -> Entry Data object.

Java

LivenessKeys.KEY_IEOS_LIVENESS_TIME_OUT LivenessKeys.KEY_IEOS_LIVENESS_ACTION_COUNT LivenessKeys.KEY_IEOS_LIVENESS_FRAMES_COUNT LivenessKeys.KEY_IEOS_LIVENESS_MAX_FAILED_ATTEMPTS

Example of parsing keys from Response Upload:

val actionTimeOut = Integer.parseInt(responseUpload?.entryData?.get(LivenessKeys.KEY_IEOS_LIVENESS_TIME_OUT))
val numberOfActions = Integer.parseInt(responseUpload?.entryData?.get(LivenessKeys.KEY_IEOS_LIVENESS_ACTION_COUNT))
val numberOfFrames = Integer.parseInt(responseUpload?.entryData?.get(LivenessKeys.KEY_IEOS_LIVENESS_FRAMES_COUNT))
val maxFailAttempts = Integer.parseInt(responseUpload?.entryData?.get(LivenessKeys.KEY_IEOS_LIVENESS_MAX_FAILED_ATTEMPTS))
val configuration = Configuration(actionTimeOut, numberOfActions, numberOfFrames, maxFailAttempts)
Was this page helpful?