From iPhone 5S onwards Apple introduced fingerprint scanner which lets applications verify if the user is the phone owner. In future Apple may allow apps to take raw fingerprints and provide some other information.
Now Intel XDK apps can make use of the fingerprint scanner to verify user ownership if the app is running in iPhone 5S or higher. It also requires iPhone to have iOS 8+ operating system running.
Touch ID Plugin
To use iPhone fingerprint scanner you need to include Touch ID plugin in your app.
Authenticating User Ownership
Here is the JavaScript code to authenticate if user is device owner or not
if(intel.xdk.device.platform == "iOS")
{
window.touchid.checkSupport(function(){
//fingerprint supported
window.touchid.authenticate(function(){
alert("Authentication Passed");
}, function(){
alert("Authentication Failed");
}, "Are you the device owner?");
}, function(){
//fingerprint not supported. Use some other way to verify ownership
});
}
else
{
//fingerprint not supported. Use some other way to verify ownership
}
},false);
Here is how it looks
Testing
You cannot test this code in emulator or app preview. You have to build iOS binary to test it on real device. Third party plugins don’t work in legacy apps therefore you have to build a cordova hybrid app.