Android - Check for Fingerprint Hardware

public int checkFingerPrintHardware() {
    int status = 0;
    // Check if we're running on Android 6.0 (M) or higher
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        //Fingerprint API only available on from Android 6.0 (M)
        // FingerprintManager fingerprintManager = (FingerprintManager) getSystemService(Context.FINGERPRINT_SERVICE);
        if (!fingerprintManager.isHardwareDetected()) {
            // Device doesn't support fingerprint authentication
            // status = 0;
        } else if (!fingerprintManager.hasEnrolledFingerprints()) {
            // User hasn't enrolled any fingerprints to authenticate with
            // status = 1;
        } else {
            status = 2;
            // Everything is ready for fingerprint authentication
        }
        return status;
    }
}

Comments

Popular posts from this blog

Android - Using KeyStore to encrypt and decrypt the data

Stack and Queue

Java Reflection API