Android检查指纹扫描仪是否可用

7
如果指纹扫描器可用,让用户通过验证指纹来使用我的应用程序功能。
2个回答

18

尝试使用以下代码:

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 
}

2
现在这个已经被弃用了,你应该使用BiometricPrompt。 - Leo DroidCoder

0

6
这似乎是@CommonsWare的回答的复制,https://dev59.com/mJPfa4cB1Zd3GeqPJemK#35302139。 - efeyc

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接