指纹解锁
验证keyguardManager.isKeyguardSecure()是否开启:
KeyguardManager keyguardManager = getSystemService(KeyguardManager.class);
if (!keyguardManager.isKeyguardSecure()) {
// Show a message that the user hasn’t set up a fingerprint or lock screen.
Toast.makeText(this, getResources().getString(R.string.not_set_secure_lock),
Toast.LENGTH_LONG).show();
purchaseButton.setEnabled(false);
purchaseButtonNotInvalidated.setEnabled(false);
return;
}
判断是否录入指纹:
FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class);
if (!fingerprintManager.hasEnrolledFingerprints()) {
purchaseButton.setEnabled(false);
// This happens when no fingerprints are registered.
Toast.makeText(this, ge