Update DeviceAvailability to work with Android < 6 (#109)

Validate that the build version supports FingerprintManager before using it. Return false when not supported
This commit is contained in:
shofman 2018-02-28 14:14:36 +01:00 committed by Joel Arvidsson
parent 009f7566a8
commit 61b6626f34
1 changed files with 6 additions and 5 deletions

View File

@ -7,12 +7,13 @@ import android.hardware.fingerprint.FingerprintManager;
public class DeviceAvailability {
public static boolean isFingerprintAuthAvailable(Context context) {
FingerprintManager fingerprintManager =
if (android.os.Build.VERSION.SDK_INT >= 23) {
FingerprintManager fingerprintManager =
(FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
return android.os.Build.VERSION.SDK_INT >= 23 &&
fingerprintManager.isHardwareDetected() &&
fingerprintManager.hasEnrolledFingerprints();
return fingerprintManager.isHardwareDetected() &&
fingerprintManager.hasEnrolledFingerprints();
}
return false;
}
public static boolean isSecure(Context context) {