Skip to content

Instantly share code, notes, and snippets.

@SmartfaceDocs
Last active December 19, 2020 12:00
Show Gist options
  • Save SmartfaceDocs/a7874ecf485b3870903c to your computer and use it in GitHub Desktop.
Save SmartfaceDocs/a7874ecf485b3870903c to your computer and use it in GitHub Desktop.
Device fingerprint
if (Device.canEvaluateFingerPrint) {
// here scan fingerprint method can be called
} else {
// biometry is not available for that device
}
var myButton = new SMF.UI.TextButton({
top : "25%",
left : "15%",
height : "10%",
width : "70%",
text : "Scan fingerPrint"
});
myButton.onPressed = function () {
if (Device.canEvaluateFingerPrint) {
Device.scanFingerPrint({
title : "myTitle", // Android only, ignored in iOS
subtitle : "mySubtitle",
icon : "myicon.png", // Android only, ignored in iOS
fallbackText : "Enter Password" // iOS only, ignored in Android
}, function onSuccess(e) {
// Scan is success
}, function onError(e) {
alert("code: " + e.code +
"\n description: " + e.description);
if (e.code == "-3") { // -3 is errorCode of fallback
// a password field can be showed to user
alert("Fallback called");
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment