这就是我真正被困住的地方..我搜索的所有地方都发现了Google登录和密码以及各种各样的东西,但我想要的只是一个简单的活动,用户将手指放在指纹传感器上,它检查它是否与存储的匹配,然后转到下一个功能。但我无法在任何地方找到它,所以有人可以帮助我吗?
这是我现在写的用于检查手机是否支持指纹的代码:
@SuppressLint("NewApi") private boolean testFingerPrintSettings() {
print("Testing Fingerprint Settings");
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
{
print("This Android version does not support fingerprint authentication.");
return false;
}
keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
fingerprintManager = (FingerprintManager) getSystemService(FINGERPRINT_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (!keyguardManager.isKeyguardSecure()) {
print("User hasn't enabled Lock Screen");
return false;
}
}
if (ActivityCompat.checkSelfPermission(this,Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
print("User hasn't granted permission to use Fingerprint");
return false;
}
if (!fingerprintManager.hasEnrolledFingerprints()) {
print("User hasn't registered any fingerprints");
return false;
}
print("Fingerprint authentication is set.\n");
return true;
}
所有检查和完成,我现在需要的是一个浮动活动,检查存储的指纹是否与用户输入的指纹相同