Touch ID

Contents

Scan the fingerprint of a user with the TouchID sensor.

Requires Cordova plugin: cordova-plugin-touch-id. For more info, please see the TouchID plugin docs.

https://github.com/EddyVerbruggen/cordova-plugin-touch-id

联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

Ionic 指纹扫描Touch ID插件的安装(Installation)

ionic cordova plugin add cordova-plugin-touch-id npm install @ionic-native/touch-id
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/touch-id

Ionic 指纹扫描Touch ID插件支持的平台(Supported Platforms)

  • iOS

Ionic 指纹扫描Touch ID插件的用法(Usage)

import { TouchID } from '@ionic-native/touch-id/ngx';

constructor(private touchId: TouchID) { }

...

this.touchId.isAvailable()
  .then(
    res => console.log('TouchID is available!'),
    err => console.error('TouchID is not available', err)
  );

this.touchId.verifyFingerprint('Scan your fingerprint please')
  .then(
    res => console.log('Ok', res),
    err => console.error('Error', err)
  );

Error Codes

The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.

Here is a list of some of the error codes:

  • -1 - Fingerprint scan failed more than 3 times
  • -2 or -128 - User tapped the 'Cancel' button
  • -3 - User tapped the 'Enter Passcode' or 'Enter Password' button
  • -4 - The scan was cancelled by the system (Home button for example)
  • -6 - TouchID is not Available
  • -8 - TouchID is locked out from too many tries