Lokesh Lokesh - 6 months ago 24
Android Question

How to check device compatibility for finger print authentication in android

I am working with finger print authentication using android 6.0 api.
My requirement is, if current device is supports finger print authentication, then I will go through finger print authentication else will use normal way to login the application.

So, any one can tell me, how to check device compatibility for finger print authentication in android.

Thanks in advance.

Answer

You have to use method isHardwareDetected on FingerprintManager class.

Determine if fingerprint hardware is present and functional. Returns true if hardware is present and functional, false otherwise.

FingerprintManager fingerprintManager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
if (!fingerprintManager.isHardwareDetected()) { 
    // Device doesn't support fingerprint authentication     
} else if (!fingerprintManager.hasEnrolledFingerprints()) { 
    // User hasn't enrolled any fingerprints to authenticate with 
} else { 
    // Everything is ready for fingerprint authentication 
}