本文整理匯總了Java中android.hardware.fingerprint.FingerprintManager.authenticate方法的典型用法代碼示例。如果您正苦於以下問題:Java FingerprintManager.authenticate方法的具體用法?Java FingerprintManager.authenticate怎麽用?Java FingerprintManager.authenticate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.hardware.fingerprint.FingerprintManager
的用法示例。
在下文中一共展示了FingerprintManager.authenticate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startAuth(FingerprintManager manager,
FingerprintManager.CryptoObject cryptoObject) {
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context,
Manifest.permission.USE_FINGERPRINT) !=
PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例2: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startAuth(FingerprintManager manager,
FingerprintManager.CryptoObject cryptoObject) {
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(appContext,
Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(appContext,
appContext.getString(R.string.fingerprint_error_no_permission),
Toast.LENGTH_LONG).show();
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例3: scanFingerprint
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
private boolean scanFingerprint() throws CertificateException, NoSuchAlgorithmException,
IOException, UnrecoverableKeyException, KeyStoreException, InvalidKeyException,
InvalidAlgorithmParameterException, NoSuchPaddingException {
FingerprintManager fingerprintManager = (FingerprintManager) getSystemService(FINGERPRINT_SERVICE);
//noinspection ResourceType
if (fingerprintManager.isHardwareDetected()) {
Cipher cipher = getCipherInstance();
IvParameterSpec ivSpec = new IvParameterSpec(mIvData);
SecretKey key = (SecretKey) mKeyStore.getKey(KEY_NAME, null);
cipher.init(Cipher.DECRYPT_MODE, key, ivSpec);
FingerprintManager.CryptoObject cryptoObject = new FingerprintManager.CryptoObject(cipher);
//noinspection ResourceType
fingerprintManager.authenticate(cryptoObject, mCancellationSignal, 0x0, mAuthenticationCallback, mHandler);
return true;
} else {
return false;
}
}
示例4: observeFingerprintActions
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
private void observeFingerprintActions(){
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.M) {
return;
}
FingerprintManager manager = (FingerprintManager) getApplicationContext().getSystemService(Context.FINGERPRINT_SERVICE);
this.fingerprintCancellationSignal = new CancellationSignal();
final FingerprintManager.AuthenticationCallback callback = (FingerprintManager.AuthenticationCallback) fingerprintCallback;
manager.authenticate(null, fingerprintCancellationSignal, 0, callback, null);
}
示例5: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
if (mContext != null)
if (mContext.checkSelfPermission(Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(mContext, "Fingerprint permission denied", Toast.LENGTH_SHORT).show();
return;
}
cancellationSignal = new CancellationSignal();
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例6: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例7: startListening
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
/**
* @param manager FingerprintManager instance
* @param cryptoObject Crypto object
*/
public void startListening(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
listeningState = true;
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例8: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
@TargetApi(23)
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
CancellationSignal cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例9: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例10: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
CancellationSignal cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(appContext, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
Log.e(TAG, "No permissions for USE_FINGERPRINT");
return;
}
Log.d(TAG, "Attempting to authenticate...");
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例11: start
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
@RequiresPermission(Manifest.permission.USE_FINGERPRINT)
public void start(FingerprintManager fpm) {
if (fpm == null || mCallback == null) {
// FIXME: 23/05/16 report error?
return;
}
mSelfCancelled = false;
mCancellationSignal = new CancellationSignal();
fpm.authenticate(mCryptoObject, mCancellationSignal, 0 /* flags */, this, null);;
}
示例12: authenticate
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
void authenticate(final CancellationSignal cancellationSignal,
final AuthenticationListener listener,
final Reprint.RestartPredicate restartPredicate,
final int restartCount) throws SecurityException {
final FingerprintManager fingerprintManager = fingerprintManager();
if (fingerprintManager == null) {
listener.onFailure(AuthenticationFailureReason.UNKNOWN, true,
context.getString(R.string.fingerprint_error_unable_to_process), TAG, FINGERPRINT_ERROR_CANCELED);
return;
}
final FingerprintManager.AuthenticationCallback callback =
new AuthCallback(restartCount, restartPredicate, cancellationSignal, listener);
// Why getCancellationSignalObject returns an Object is unexplained
final android.os.CancellationSignal signalObject = cancellationSignal == null ? null :
(android.os.CancellationSignal) cancellationSignal.getCancellationSignalObject();
// Occasionally, an NPE will bubble up out of FingerprintManager.authenticate
try {
fingerprintManager.authenticate(null, signalObject, 0, callback, null);
} catch (NullPointerException e) {
logger.logException(e, "MarshmallowReprintModule: authenticate failed unexpectedly");
listener.onFailure(AuthenticationFailureReason.UNKNOWN, true,
context.getString(R.string.fingerprint_error_unable_to_process), TAG, FINGERPRINT_ERROR_CANCELED);
}
}
示例13: authenticate
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.M)
public void authenticate(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
CancellationSignal cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) !=
PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例14: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(appContext, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例15: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
/**
* Start the finger print authentication by enabling the finger print sensor.
* Note: Use this function in the onResume() of the activity/fragment. Never forget to call {@link #stopAuth()}
* in onPause() of the activity/fragment.
*/
@TargetApi(Build.VERSION_CODES.M)
void startAuth() {
if (isScanning) stopAuth();
//check if the device supports the finger print hardware?
if (!checkFingerPrintAvailability(mContext)) return;
FingerprintManager fingerprintManager = (FingerprintManager) mContext.getSystemService(Context.FINGERPRINT_SERVICE);
FingerprintManager.CryptoObject cryptoObject = getCryptoObject();
if (cryptoObject == null) {
mCallback.onFingerprintAuthFailed(NON_RECOVERABLE_ERROR, ERROR_FAILED_TO_INIT_CHIPPER);
} else {
mCancellationSignal = new CancellationSignal();
//noinspection MissingPermission
fingerprintManager.authenticate(cryptoObject,
mCancellationSignal,
0,
new FingerprintManager.AuthenticationCallback() {
@Override
public void onAuthenticationError(int errMsgId, CharSequence errString) {
mCallback.onFingerprintAuthFailed(NON_RECOVERABLE_ERROR, errString.toString());
}
@Override
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
mCallback.onFingerprintAuthFailed(RECOVERABLE_ERROR, helpString.toString());
}
@Override
public void onAuthenticationFailed() {
mCallback.onFingerprintAuthFailed(CANNOT_RECOGNIZE_ERROR, "Cannot recognize the fingerprint.");
}
@Override
public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
mCallback.onFingerprintAuthSuccess(result.getCryptoObject());
}
}, null);
}
}