FingerprintManager class supports Android devices running on API 23 or higher and throws an exception on devices with earlier versions of Android.
FingerprintManagerCompat class returns the backward compatibility of the isHardwareDetected method in the lower version of Android, but always returns false for API 23 or higher
I chose the best one and created this method to test the hardware support of the FingerPrint Sensor in all versions of Android .
private boolean isSensorAvialable() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return ActivityCompat.checkSelfPermission(AppContext, Manifest.permission.USE_FINGERPRINT) == PackageManager.PERMISSION_GRANTED && AppContext.getSystemService(FingerprintManager.class).isHardwareDetected(); } else { return FingerprintManagerCompat.from(AppContext).isHardwareDetected(); } }
source share