18

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);
    }
GrecoJava
  • 301
  • 3
  • 6

1 Answers1

11

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;
}
Miguel
  • 263
  • 5
  • 12
  • Hey Miguel, would this work for other non Samsung devices? – Kennedy Jun 17 '17 at 09:36
  • 1
    @Kennedy no, http://developer.samsung.com/galaxy/pass says about what devices can use their SDK: "Any Samsung Mobile device that supports the fingerprint sensor and the Fingerprint Service with Android 4.2 (Jelly Bean API 17) and above." – Jules Jul 17 '17 at 08:20
  • In case you need to check for registered fingers use this: SpassFingerprint spassFingerprint = new SpassFingerprint(context); return spassFingerprint.hasRegisteredFinger(); – Nguyen Minh Hien Aug 22 '18 at 12:01
  • Can someone please confirm this on a Samsung Galaxy J7? – Shishir Shetty Jan 21 '19 at 18:42