mjwheatley / cordova-plugin-android-fingerprint-auth

A cordova plugin for fingerprint authentication using the hardware fingerprint scanner on devices running Android 6+
Apache License 2.0
169 stars 131 forks source link

isAvailable() succeeds but it returns `false` on Google Pixel 2 (Android 8) #115

Closed Muzietto closed 6 years ago

Muzietto commented 6 years ago

I am using plugin version 1.4.0. My test phone is a fresh Google Pixel 2 with Android 8 and SDK level 27. I could not find the specific fingerprint API version, but it could be greater than 6.

The initial call to isAvailable(cbs, cbf) succeeds, but it returns false.

Is this plugin able to support fingerprint API versions >6?

mjwheatley commented 6 years ago

The Android Fingerprint API has not changed since 6.0 to my knowledge. Please report the entire result object. Also check isHardwaredDetected and hasEnrolledFingerprints

console.log("isFingerprintAvailable() result: " + JSON.stringify(result));
if (!result.isAvailable) {
    if (!result.isHardwareDetected) {
        errorMsg = self.translate.instant("fingerprint-helper.errors.hardwareRequired");
    } else if (!result.hasEnrolledFingerprints) {
        errorMsg = self.translate.instant("fingerprint-helper.errors.noFingerprints");
    }
    let alert = self.alertCtrl.create({
        title: self.translate.instant("fingerprint-helper.errors.notAvailable"),
        message: errorMsg,
        buttons: [self.translate.instant("general.ok")]
    );
    alert.present();
}

Perhaps if it is a fresh Google Pixel 2, you have not enrolled any fingerprints yet?

Muzietto commented 6 years ago

Yes, there we no fingerprints. Gotta check hasEnrolledFingerprints first. Thank you very much.