@Override protected void doIdentify() { try { mCancellationSignal = new CancellationSignal(); mFingerprintManagerCompat.authenticate(null, 0, mCancellationSignal, new FingerprintManagerCompat.AuthenticationCallback() { @Override
public void startListening(FingerprintManagerCompat.CryptoObject cryptoObject) { if (!mListening) { mListening = true; mCancellationSignal = new CancellationSignal(); mSelfCancelled = false; mFingerprintManagerCompat .authenticate(cryptoObject, 0, mCancellationSignal, this, null); mSwirlView.setState(SwirlView.State.ON); } }
void beginAuthentication() { cancellationSignal = new CancellationSignal(); FingerprintManagerCompat.AuthenticationCallback callback = new FingerprintManagerCompat.AuthenticationCallback() { @Override public void onAuthenticationError(int errMsgId, CharSequence errString) { super.onAuthenticationHelp(errMsgId, errString); if (!canceled) { fingerprintView.onError(errString.toString(), true); } } @Override public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) { super.onAuthenticationHelp(helpMsgId, helpString); if (!canceled) { fingerprintView.onError(helpString.toString(), false); } } @Override public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) { super.onAuthenticationSucceeded(result); fingerprintView.onSuccess(result.getCryptoObject()); } @Override public void onAuthenticationFailed() { super.onAuthenticationFailed(); fingerprintView.onError(R.string.fingerprint_not_recognized); } }; fingerprintManager.authenticate(fingerprintView.cryptoObject(), 0, cancellationSignal, callback, null); }
/** * Runs the provided SQL and returns a {@link Cursor} over the result set. * * @param supportQuery the SQL query. The SQL string must not be ; terminated * @param signal A signal to cancel the operation in progress, or null if none. * If the operation is canceled, then {@link OperationCanceledException} will be thrown * when the query is executed. * @return A {@link Cursor} object, which is positioned before the first entry. Note that * {@link Cursor}s are not synchronized, see the documentation for more details. */ @Override @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) public Cursor query(SupportSQLiteQuery supportQuery, android.os.CancellationSignal signal) { final CancellationSignal supportCancellationSignal = new CancellationSignal(); signal.setOnCancelListener(new android.os.CancellationSignal.OnCancelListener() { @Override public void onCancel() { supportCancellationSignal.cancel(); } }); return query(supportQuery, supportCancellationSignal); }
/** * Start an authentication request. * * @param listener The listener to be notified. * @param restartPredicate The predicate that determines whether to restart or not. */ public void authenticate(final AuthenticationListener listener, Reprint.RestartPredicate restartPredicate) { if (module == null || !module.isHardwarePresent()) { listener.onFailure(AuthenticationFailureReason.NO_HARDWARE, true, getString(R.string.fingerprint_error_hw_not_available), 0, 0); return; } if (!module.hasFingerprintRegistered()) { listener.onFailure(AuthenticationFailureReason.NO_FINGERPRINTS_REGISTERED, true, getString(R.string.fingerprint_not_recognized), 0, 0); return; } cancellationSignal.set(new CancellationSignal()); module.authenticate(cancellationSignal.get(), listener, restartPredicate); }
FingerprintManagerCompat fingerprintManagerCompat = FingerprintManagerCompat.from(context); fingerprintManagerCompat.authenticate(cryptoObject, 0, new CancellationSignal(), new FingerprintManagerCompat.AuthenticationCallback() { @Override