I\'m assuming that no phones with OS before marshmallow support the fingerprint API.
My questions are:
(a) Do all/any Samsung phones released with marshmallow
After understanding more clearly requirement from comment below my answer, here is updated answer
Pass is the SDK responsible for Fingerprint feature for Samsung devices. What you can do, you can check if device is using Pass
SDK or not.
Below is code to check it:
FingerprintManager fingerprintManager = (FingerprintManager) getApplicationContext().getSystemService(Context.FINGERPRINT_SERVICE);
boolean isFingerprintSupported = fingerprintManager != null && fingerprintManager.isHardwareDetected();
if (!isFingerprintSupported && SsdkVendorCheck.isSamsungDevice()) { // for samsung devices which doesn't support Native Android Fingerprint API
Spass spass = new Spass();
try {
spass.initialize(context);
isFingerprintSupported = spass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT);
} catch (SsdkUnsupportedException | UnsupportedOperationException e) {
//Error handling here
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // for devices which doesn't support Pass SDK
FingerprintManager fingerprintManager = (FingerprintManager) getApplicationContext().getSystemService(Context.FINGERPRINT_SERVICE);
if (!fingerprintManager.isHardwareDetected()) {
// This device is not supporting fingerprint authentication
} else if (!fingerprintManager.hasEnrolledFingerprints()) {
// User hasn't enrolled any fingerprints to authenticate with
} else {
// Everything is ready for fingerprint authentication
}
}
}
Add below permissions to AndroidManifest.xml.
I hope this will help.