Java Code Examples for android.hardware.biometrics.BiometricPrompt#AuthenticationResult

The following examples show how to use android.hardware.biometrics.BiometricPrompt#AuthenticationResult . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BioAuthenticationCallback.java    From secure-quick-reliable-login with MIT License 5 votes vote down vote up
@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();
    }
}
 
Example 2
Source File: AuthenticationCallbackV28.java    From FingerprintDialogCompat with Apache License 2.0 4 votes vote down vote up
/**
 * @see BiometricPrompt.AuthenticationCallback#onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult)
 */
@Override
public void onAuthenticationSucceeded(final BiometricPrompt.AuthenticationResult result) {
    super.onAuthenticationSucceeded(result);
    mCallback.onAuthenticationSucceeded();
}
 
Example 3
Source File: SmartLockHelper.java    From samples-android with Apache License 2.0 4 votes vote down vote up
@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);
}
 
Example 4
Source File: BiometricCallbackV28.java    From smart-farmer-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
    super.onAuthenticationSucceeded(result);
    biometricCallback.onAuthenticationSuccessful(result.getCryptoObject().getCipher());
}