The fingerprint feature enables you to implement fingerprint authentication in your mobile application.
Supported Platforms
This feature is supported in the following platforms:
- iOS
- Android
Installation
iOS
This plugin requires the following:
- iOS 8 version (minimum)
- iPhone 5S or newer mobile device that has a fingerprint scanner
To install the Fingerprint plugin for iOS, execute the following command in your Cordova project directory:
cordova plugin add cordova-plugin-touch-id
Android
To install the Fingerprint plugin for Android, execute the following command in your Cordova project directory:
cordova plugin add cordova-plugin-android-fingerprint-auth
Usage
// This function checks whether or not the user has configured the fingerprint scanner this.fm.registerHandler("cbxclick", "AVAIL", function (fm, event, fieldName, value) { canvas.env.util.fingerPrint.isAvailable(SuccessCallback, ErrorCallback); }); /* To authenticate the fingerprint * This method opens a native dialog fragment to use the device hardware fingerprint scanner * to authenticate against fingerprints registered for the device. */ this.fm.registerHandler("cbxclick", "AUTHENTICATE", function (fm, event, fieldName, value) { var params = { buttonLabel: "Enter your PIN", popupMessage: "Please scan your fingerprint", clientSecret: "Used to encrypt the token returned upon successful fingerprint authentication.", clientId: "Used as the alias for your key in the Android Key Store" }; canvas.env.util.fingerPrint.authenticate(params, successCallback, errorCallback); }); /* SuccessCallback will get call only if the fingerprint or touch ID is available on a device. * If the SuccessCallback handler was called, you can scan the fingerprint. */ function SuccessCallback(result) { showAlert("available"); } // ErrorCallback will get call if the device has no TouchID available function ErrorCallback(error) { showAlert("not available:" + error); }