What should I use instead of biometricManager.canAuthenticate() is deprecated.
Doc says
This method is deprecated. Use canAuthenticate(int) instead.
BiometricManager biometricManager = BiometricManager.from(this);
switch (biometricManager.canAuthenticate()){
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
break;
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
break;
case BiometricManager.BIOMETRIC_SUCCESS:
break;
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
break;
case BiometricManager.BIOMETRIC_ERROR_UNSUPPORTED:
break;
}
How to use canAuthenticate(int) like the above manner.
Advertisement
Answer
The direct replacement for your code would look something like:
switch (canAuthenticate(Authenticators.BIOMETRIC_WEAK)) {
case ...
}
According to the javadoc, the possible return values are BIOMETRIC_SUCCESS, BIOMETRIC_ERROR_HW_UNAVAILABLE, BIOMETRIC_ERROR_NONE_ENROLLED, BIOMETRIC_ERROR_NO_HARDWARE, or BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED., as before.