For offline usage OfflineLivenessFragment is required, it will return results straight from the liveness engine.
OfflineLivenessFragment has the following dependencies :
- OfflineLivenessFragment.LivenessListener – A listener that will provide a response of once liveness has been completed
- Configuration – Configuration of the liveness engine
Setting up OfflineLivenessFragment
Kotlin
val livenessFragment = OfflineLivenessFragment(offlineLivenessListener,
configuration) //optional
Java
OfflineLivenessFragment livenessFragment = new OfflineLivenessFragment(offlineLivenessListener,
configuration); //optional
Kotlin
private
val offlineLivenessListener: LivenessListener = object : LivenessListener {
override fun onAggregatedResult(result: AggregatedResult) {)
// Will return final result
}
override fun onActionEventAudit(audit: ActionResultState) {
// Will return each action final result.
}
private val offlineLivenessListener: LivenessListener = object : LivenessListener {
override fun onAggregatedResult(result: AggregatedResult) {)
// Will return final result
}
override fun onActionEventAudit(audit: ActionResultState) {
// Will return each action final result.
}
override fun onNewImage(bitmap: Bitmap) {
// Will return images dedicated for Face Match result.
}
override fun onError(livenessError: ScannerError) {
// Will return on error object of Scanner.
}
}