Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

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);
    }
like image 644
GrecoJava Avatar asked Jun 21 '16 05:06

GrecoJava


1 Answers

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;
}
like image 69
Miguel Avatar answered Sep 18 '22 06:09

Miguel