下面列出了android.hardware.biometrics.BiometricPrompt#AuthenticationResult ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
super.onAuthenticationSucceeded(result);
try {
BiometricPrompt.CryptoObject co = result.getCryptoObject();
SQRLStorage.getInstance(context).decryptIdentityKeyBiometric(co.getCipher());
new Thread(doneCallback).start();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* @see BiometricPrompt.AuthenticationCallback#onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult)
*/
@Override
public void onAuthenticationSucceeded(final BiometricPrompt.AuthenticationResult result) {
super.onAuthenticationSucceeded(result);
mCallback.onAuthenticationSucceeded();
}
@TargetApi(P)
@Deprecated
private void showBiometricPrompt(FragmentActivity activity, FingerprintDialogCallbacks callback, Cipher cipher) {
CancellationSignal mCancellationSignal = new CancellationSignal();
BiometricPrompt biometricPrompt = new BiometricPrompt.Builder(activity)
.setTitle(activity.getString(R.string.fingerprint_alert_title))
.setNegativeButton(activity.getString(R.string.cancel), activity.getMainExecutor(), (dialogInterface, i) -> {
callback.onFingerprintCancel();
})
.build();
BiometricPrompt.AuthenticationCallback authenticationCallback = new BiometricPrompt.AuthenticationCallback() {
@Override
public void onAuthenticationError(int errorCode, CharSequence errString) {
super.onAuthenticationError(errorCode, errString);
callback.onFingerprintCancel();
}
@Override
public void onAuthenticationHelp(int helpCode, CharSequence helpString) {
super.onAuthenticationHelp(helpCode, helpString);
callback.onFingerprintCancel();
}
@Override
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
super.onAuthenticationSucceeded(result);
if (result.getCryptoObject() != null) {
callback.onFingerprintSuccess(result.getCryptoObject().getCipher());
} else {
callback.onFingerprintSuccess(null);
}
}
@Override
public void onAuthenticationFailed() {
super.onAuthenticationFailed();
callback.onFingerprintCancel();
}
};
biometricPrompt.authenticate(mCancellationSignal, activity.getMainExecutor(), authenticationCallback);
}
@Override
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
super.onAuthenticationSucceeded(result);
biometricCallback.onAuthenticationSuccessful(result.getCryptoObject().getCipher());
}