USE_FINGERPRINT is deprecated in API level 28

前端 未结 3 1555
感情败类
感情败类 2021-02-03 18:44

Constant USE_FINGERPRINT was deprecated in API level 28 and we should use more generic USE_BIOMETRIC which has been added in same API level.

I

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-03 19:16

    I've faced the same problem, imho the short answer is to ignore the deprecation, as long as you only want to support fingerprint authentication in your app.

    As stated in the google dev blog, since API 28 google comes up with the new biometrics API, which simplifies the whole process of biometrics authentication. They provide a simple builder for the auth-dialog. Additionally, they support face and iris detection, too - imho it is just a matter of time if you want to support it and probably might be worth upgrading it.

    The only disadvantage I've discovered so far is that if you want to check if e.g. fingerprint hardware is available, you'll have to start the authentication process to check this out and wait for the error callback. The deprecated fingerprint API instead provides methods like isHardwareDetected() or hasEnrolledFingerprints() for this purpose. In this case, you would probably have to re-design your application, if you rely on this information. The reason for the deprecation of those methods is probably, that it only supports fingerprints, therefore it is not a bad idea to upgrade it.

    Google has also provided the compat 'androidx.biometric:biometric:1.0.0-alpha02' version for the devices below API 28, it seems that by importing this dependency, you could simply switch to USE_BIOMETRIC permission without modifying anything else in your app - you won't be bothered by the warning anymore. Since it is only in alpha stage, I would use it with care. Therefore, as long as you don't use anything from the biometrics API, you could also simply ignore the problem and face it again when you want to support additional biometric authentication methods.

    EDIT: Now, the beta version of compat library is released, 'androidx.biometric:biometric:1.0.0-beta01'. For more info on this, check here.

    Now, the stable version of compat library is released on December 18, 2019, 'androidx.biometric:biometric:1.0.1'. For more info on this Click here.

提交回复
热议问题