如果指纹扫描仪可用,则允许用户通过使用指纹进行身份验证来使用我的应用功能。
答案 0 :(得分:17)
试试这段代码:
FingerprintManager fingerprintManager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
if (!fingerprintManager.isHardwareDetected()) {
// Device doesn't support fingerprint authentication
} else if (!fingerprintManager.hasEnrolledFingerprints()) {
// User hasn't enrolled any fingerprints to authenticate with
} else {
// Everything is ready for fingerprint authentication
}
答案 1 :(得分:0)
PackageManager
个实例上的 Try hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)
(您可以通过任意方便getPackageManager()
致电Context
获得一个。)