startLivenessDetectionOnlySDK method
Future<BlusaltLivenessResultResponse?>
startLivenessDetectionOnlySDK({
- required String apiKey,
- required String appName,
- required String clientId,
- required bool isDev,
- String? reference,
- String? webhookUrl,
- LivenessDetectionOnlyType livenessDetectionOnlyType = LivenessDetectionOnlyType.motional,
- bool collectDeviceId = false,
- bool collectDeviceLocation = false,
- bool? startProcessOnGettingToFirstScreen,
- int? timeoutDurationInSec,
override
livenessDetectionOnlyType can be LivenessDetectionOnlyType.motional or LivenessDetectionOnlyType.still or LivenessDetectionOnlyType.flash
timeoutDurationInSec this value can be used top override the timeout duration of networks calls in the SDK.
When set to null or no value is passed, it will use the default value from SDK 120s.. @override
Implementation
@override
Future<BlusaltLivenessResultResponse?> startLivenessDetectionOnlySDK(
{required String apiKey,
required String appName,
required String clientId,
required bool isDev,
String? reference,
String? webhookUrl,
LivenessDetectionOnlyType livenessDetectionOnlyType =
LivenessDetectionOnlyType.motional,
bool collectDeviceId = false,
bool collectDeviceLocation = false,
bool? startProcessOnGettingToFirstScreen,
int? timeoutDurationInSec}) async {
try {
final result =
await methodChannel.invokeMethod('startLivenessDetectionOnlySDK', {
'apiKey': apiKey,
'appName': appName,
'clientId': clientId,
'isDev': isDev,
'reference': reference,
'webhookUrl': webhookUrl,
'livenessType': livenessDetectionOnlyType.name.toUpperCase(),
'collectDeviceId': collectDeviceId,
'collectDeviceLocation': collectDeviceLocation,
'startProcessOnGettingToFirstScreen':
startProcessOnGettingToFirstScreen ?? false,
'timeoutDurationInSec': timeoutDurationInSec,
});
if (result != null) {
var response = json.decode(result);
var originalByteDataInString =
(response['faceDetectionData']?['originalLivenessImage'] ?? '')
.toString();
var byteDataInString =
(response['faceDetectionData']?['livenessImage'] ?? '').toString();
return BlusaltLivenessResultResponse(
blusaltLivenessProcess: BlusaltLivenessProcess.completed,
reference: reference,
isPassProcedureValidation:
response['isProcedureValidationPassed'] ?? false,
faceDetectionData: BlusaltFaceDetectionData(
isPassFaceGenuiness: response['faceDetectionData']
['isPassFaceGenuineness'],
originalLivenessImageByteWithBg: originalByteDataInString,
imageByte: byteDataInString),
deviceMetaData: DeviceMetaData(
deviceId: response['deviceMetaData']?['deviceId'],
deviceLocation: DeviceLocation(
address: response['deviceMetaData']?['deviceLocation']
?['address'] ??
'',
locality: response['deviceMetaData']?['deviceLocation']
?['locality'] ??
'',
longitude: response['deviceMetaData']?['deviceLocation']
?['longitude'] ??
'',
latitude: response['deviceMetaData']?['deviceLocation']
?['latitude'] ??
'',
)));
} else {
return BlusaltLivenessResultResponse(
blusaltLivenessProcess: BlusaltLivenessProcess.notImplemented,
message: "Something went wrong");
}
} on PlatformException catch (exception) {
return BlusaltLivenessResultResponse(
blusaltLivenessProcess: BlusaltLivenessProcess.notImplemented,
exception: exception,
message: exception.message,
code: exception.code);
} catch (e) {
return BlusaltLivenessResultResponse(
blusaltLivenessProcess: BlusaltLivenessProcess.notImplemented,
message: e.toString());
}
}