當前位置: 首頁>>代碼示例>>Java>>正文


Java FingerprintManager.authenticate方法代碼示例

本文整理匯總了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);
}
 
開發者ID:noosomii,項目名稱:FingerprintDemo,代碼行數:13,代碼來源:FingerprintHelper.java

示例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);
}
 
開發者ID:hacktoberfest17,項目名稱:programming,代碼行數:18,代碼來源:FingerprintHandler.java

示例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;
    }
}
 
開發者ID:keiji,項目名稱:simple-marshmallow-samples,代碼行數:26,代碼來源:FingerprintActivity.java

示例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);
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:13,代碼來源:EnterPinPresenter.java

示例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);
    }
 
開發者ID:aboutZZ,項目名稱:WeChatFingerprintPay,代碼行數:11,代碼來源:FingerprintHandler.java

示例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);
    }
 
開發者ID:anonymous-ME,項目名稱:Automata,代碼行數:9,代碼來源:FingerprintHandler.java

示例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);
}
 
開發者ID:dev-prajwal21,項目名稱:FingerprintAssistant,代碼行數:13,代碼來源:FingerprintResultsHandler.java

示例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);
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:9,代碼來源:FingerprintHandlerSettings.java

示例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);
}
 
開發者ID:ivoribeiro,項目名稱:AndroidQuiz,代碼行數:9,代碼來源:FingerprintController.java

示例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);
}
 
開發者ID:Cirrus-Link,項目名稱:Sparkplug,代碼行數:10,代碼來源:MainActivity.java

示例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);;
}
 
開發者ID:aitorvs,項目名稱:fingerlock,代碼行數:11,代碼來源:FingerprintAuthHandler.java

示例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);
    }
}
 
開發者ID:ajalt,項目名稱:reprint,代碼行數:29,代碼來源:MarshmallowReprintModule.java

示例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);
}
 
開發者ID:TeamAmaze,項目名稱:AmazeFileManager,代碼行數:11,代碼來源:FingerprintHandler.java

示例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);
        }
 
開發者ID:citiususc,項目名稱:calendula,代碼行數:10,代碼來源:FingerprintHelper.java

示例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);
    }
}
 
開發者ID:kevalpatel2106,項目名稱:PasscodeView,代碼行數:47,代碼來源:FingerPrintAuthHelper.java


注:本文中的android.hardware.fingerprint.FingerprintManager.authenticate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。