com.samsung.android.sdk.pass.SpassFingerprint Java Examples

The following examples show how to use com.samsung.android.sdk.pass.SpassFingerprint. 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: SamsungPass.java    From arcusandroid with Apache License 2.0 5 votes vote down vote up
private static void cancelAuth(SpassFingerprint spassFingerprint){
    try {
    spassFingerprint.cancelIdentify();
    } catch (Throwable t) {
        // There's no way to query if there's an active identify request,
        // so just try to cancel and ignore any exceptions.
    }
}
 
Example #2
Source File: BiometricLoginUtils.java    From arcusandroid with Apache License 2.0 5 votes vote down vote up
private static boolean hasPassFingerprintEnrolled(Context context){
    if(initSamsungPass(context) != null){
        SpassFingerprint fingerprint = new SpassFingerprint(context);
        if (fingerprint.hasRegisteredFinger()) {
            return hasPassFingerprintEnrolled = true;
        }
    }
    return hasPassFingerprintEnrolled =false;
}
 
Example #3
Source File: SamsungFingerprint.java    From FingerprintIdentify with MIT License 5 votes vote down vote up
public SamsungFingerprint(Context context, ExceptionListener exceptionListener) {
    super(context, exceptionListener);

    try {
        Spass spass = new Spass();
        spass.initialize(mContext);
        mSpassFingerprint = new SpassFingerprint(mContext);
        setHardwareEnable(spass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT));
        setRegisteredFingerprint(mSpassFingerprint.hasRegisteredFinger());
    } catch (Throwable e) {
        onCatchException(e);
    }
}
 
Example #4
Source File: SpassReprintModule.java    From reprint with Apache License 2.0 5 votes vote down vote up
private static void cancelFingerprintRequest(SpassFingerprint spassFingerprint) {
    try {
        spassFingerprint.cancelIdentify();
    } catch (Throwable t) {
        // There's no way to query if there's an active identify request,
        // so just try to cancel and ignore any exceptions.
    }
}
 
Example #5
Source File: SamsungFingerprint.java    From FingerprintIdentify with MIT License 4 votes vote down vote up
@Override
protected void doIdentify() {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            try {
                mSpassFingerprint.startIdentify(new SpassFingerprint.IdentifyListener() {
                    @Override
                    public void onFinished(int i) {
                        mResultCode = i;
                    }

                    @Override
                    public void onReady() {

                    }

                    @Override
                    public void onStarted() {

                    }

                    @Override
                    public void onCompleted() {
                        switch (mResultCode) {
                            case SpassFingerprint.STATUS_AUTHENTIFICATION_SUCCESS:
                            case SpassFingerprint.STATUS_AUTHENTIFICATION_PASSWORD_SUCCESS:
                                onSucceed();
                                break;

                            case SpassFingerprint.STATUS_SENSOR_FAILED:
                            case SpassFingerprint.STATUS_OPERATION_DENIED:
                            case SpassFingerprint.STATUS_TIMEOUT_FAILED:
                            case SpassFingerprint.STATUS_BUTTON_PRESSED:
                            case SpassFingerprint.STATUS_QUALITY_FAILED:
                            case SpassFingerprint.STATUS_USER_CANCELLED_BY_TOUCH_OUTSIDE:
                            case SpassFingerprint.STATUS_AUTHENTIFICATION_FAILED:
                                onNotMatch();
                                break;

                            case SpassFingerprint.STATUS_USER_CANCELLED:
                                // do nothing
                                break;

                            default:
                                onFailed(false);
                                break;
                        }
                    }
                });
            } catch (Throwable e) {
                if (e instanceof SpassInvalidStateException) {
                    SpassInvalidStateException stateException = (SpassInvalidStateException) e;
                    if (stateException.getType() == 1) {
                        onFailed(true);
                    } else {
                        onCatchException(e);
                        onFailed(false);
                    }
                } else {
                    onCatchException(e);
                    onFailed(false);
                }
            }
        }
    });
}