Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
301 views
in Technique[技术] by (71.8m points)

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);
    }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...