hieuvp / react-native-fingerprint-scanner

Provide Fingerprint, Touch ID, and Face ID Scanner for React Native (Compatible with both Android and iOS)
https://www.npmjs.com/package/react-native-fingerprint-scanner
872 stars 299 forks source link

I'm getting an error FingerprintScannerNotEnrolled. #9

Closed chapeljuice closed 6 years ago

chapeljuice commented 7 years ago

Complete error says: 07-21 11:23:06.433 4639 5443 I ReactNativeJS: { [FingerprintScannerNotEnrolled: Authentication could not start because Fingerprint Scanner has no enrolled fingers.] name: 'FingerprintScannerNotEnrolled' }

What does this mean?

Some details about my environment: "react": "^16.0.0-alpha.6", "react-native": "^0.44.0", "react-native-fingerprint-scanner": "^2.1.3",

My code:



  componentDidMount() {
    if (Platform.OS === 'ios') {
      console.log('ios device, trying to use fingerprint scanner')
      // iOS code only
      FingerprintScanner
        .authenticate({ description: 'Scan your fingerprint on the device scanner to continue' })
        .then(() => {
          AlertIOS.alert('Authenticated successfully')
        })
        .catch((error) => {
          console.log(error)
        })
    } else if (Platform.OS === 'android') {
      console.log('android device, trying to use fingerprint scanner')
      // android code only
      FingerprintScanner
        .authenticate({ onAttempt: this.handleAuthenticationAttempted })
        .then(() => {
          Alert.alert('Fingerprint Authentication', 'Authenticated successfully')
        })
        .catch((error) => {
          console.log(error)
        })
    }
  }

  componentWillUnmount() {
    if (Platform.OS === 'android') {
      FingerprintScanner.release()
    }
  }
foxmicha commented 7 years ago

This error means exactly as it says: There are no fingerprints currently enrolled in the OS.

For iOS simulators, you just need to go to Hardware -> TouchID -> Toggle TouchID Enrollment Status in order to turn it on.

For Android Emulators you'll have to actually go through the process of enrolling one of the 10 fingerprints that are included in the kabob context menu (last button in the list that stays next to the Emulator when you launch it).

phillbaker commented 6 years ago

@chapeljuice any follow up here? Otherwise it looks like this issue can be closed.