How to check device compatibility for finger print authentication in android

后端 未结 4 1331
感情败类
感情败类 2020-12-04 22:09

I am working with finger print authentication using android 6.0 api. My requirement is, if current device is supports finger print authentication, then I will go through fi

4条回答
  •  天命终不由人
    2020-12-04 22:38

    This method Works for all Android versions and also check for permission

     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();
                }
            }
    

提交回复
热议问题