So how to check fingerprint feature available or not in android device? check below.
Method 1 :
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
Toast.makeText(this, "Finger print not supported", Toast.LENGTH_SHORT).show();
}
Method 2 :
FingerprintManager fingerprintManager = (FingerprintManager) getSystemService(Context.FINGERPRINT_SERVICE);
if (!fingerprintManager.isHardwareDetected()) {
// Device doesn't support fingerprint authentication
Toast.makeText(this, "Device doesn't support fingerprint authentication", Toast.LENGTH_SHORT).show();
} else if (!fingerprintManager.hasEnrolledFingerprints()) {
// User hasn't enrolled any fingerprints to authenticate with
Toast.makeText(this, "User hasn't enrolled any fingerprints to authenticate with", Toast.LENGTH_SHORT).show();
} else {
// Everything is ready for fingerprint authentication
Toast.makeText(this, "Everything is ready for fingerprint authentication", Toast.LENGTH_SHORT).show();
}
This method required USE_FINGERPRINT permision. Add in Menifest file.
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>Thank you :)
No comments:
Post a Comment