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
I can definitely tell you from my own experience that several Samsung phones continue to use Spass library even on Android M and over. For example right now I'm testing on Mobile OS: Android 6.0.1 (Galaxy Note 4 Edge). I've wrote some code that prints output to the logs in this way:
/*
* This function evaluates which fingerprint helper should be instantiated (if any)
*/
public static FingerprintHelper initializeFingerprintHelper(Context context){
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
FingerprintManager manager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
if (manager != null) {
logger.info("Android native fingerprint manager exists");
if (manager.isHardwareDetected()) {
logger.info("Android native fingerprint manager detected hardware");
if (manager.hasEnrolledFingerprints()) {
logger.info("Android native fingerprint manager has enrolled fingerprints");
}else{
logger.info("Android native fingerprint manager has no enrolled fingerprints");
}
return new AndroidFingerprintHelper(context);
}
}
}
try{
logger.info("Android native fingerprint manager is null, trying Samsung SPASS rollback");
Spass spass = new Spass();
spass.initialize(context);
if(spass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT)){
return new SamsungFingerprintHelper(context);
}
} catch (SsdkUnsupportedException e) {
logger.error("Spass library is missing on the device");
}
return null;
}
And from the logs in the console I see that although Android Version on the devices is M(6.0.1) - the method
manager.isHardwareDetected()
returns false and the method goes to Spass lib initialization and it suceeds. So the device definitely using Spass library on android M.
From my small investigation a had found the following. Pass API will help with Samsung devices, which had fingerprint api before android 6. It is devices of 2014 year with a fingerprint. The list of devices can be found here. https://en.wikipedia.org/wiki/Samsung_Galaxy The main devices:
They do not support the standard Google FingerPrint Api even after updating android to 6 version.
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.
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
I hope this will help.