简体   繁体   中英

Android M FingerprintManager.isHardwareDetected() returns false on a Samsung Galaxy S5

I have just updated a Verizion Samsung Galaxy S5 (SM-G900V) to the G900VVRU2DPD1 version via the manual instructions listed at http://www.androidofficer.com/2016/06/g900vvru2dpd1-android-601-marshmallow.html

When I run the code below, isHardwareDetected() returns 'false'. I would expect it to return 'true'.

The Googling I have done does not resulted in any information one way or the other as to the S5 fingerprint reader being supported under Marshmallow.

Does anyone have any information about the S5's fingerprint reader being supported?

    FingerprintManager manager = (FingerprintManager) getSystemService(FINGERPRINT_SERVICE);
    if (manager != null) {

        if (ActivityCompat.checkSelfPermission(this, permission.USE_FINGERPRINT) !=
                PackageManager.PERMISSION_GRANTED) {
            retVal.append(INDENT).append("Fingerprint permission was not granted")
                    .append(EOL);
        } else {
            retVal.append(INDENT).append("Fingerprint hardware detected: ")
                    .append(manager.isHardwareDetected()).append(EOL);
            retVal.append(INDENT).append("Has Enrolled Fingerprint(s): ")
                    .append(manager.hasEnrolledFingerprints()).append(EOL);
        }
    } else {
        retVal.append(INDENT).append("no FingerprintManager available").append(EOL);
    }

Finally solved. It looks like android default API is not able to handle some Samsung devices, so the solution is to add the Samsung libraries for this issue.

You can find some documentation and the libraries here: http://developer.samsung.com/galaxy/pass

After add the libraries, you have to add a new permission to your manifest:

<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />

And finally, you could use this method:

private boolean isFingerprintSupported() {
  boolean isFingerprintSupported = fingerprintManager != null && fingerprintManager.isHardwareDetected();
  if (!isFingerprintSupported && SsdkVendorCheck.isSamsungDevice()) {
    Spass spass = new Spass();
    try {
        spass.initialize(context);
        isFingerprintSupported = spass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT);
    } catch (SsdkUnsupportedException | UnsupportedOperationException e) {
        // Error handling
    }
  }
  return isFingerprintSupported;
}

can u please give us steps to achiev that in note 4 as for not programmers people like me.

Many thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM