Java Code Examples for android.support.v4.hardware.fingerprint.FingerprintManagerCompat#from()
The following examples show how to use
android.support.v4.hardware.fingerprint.FingerprintManagerCompat#from() .
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: FingerAuth.java From FingerAuth with Apache License 2.0 | 5 votes |
private void init(Context context) { failedCount = 0; authenticationCallback = new FingerprintManagerCompat.AuthenticationCallback() { @Override public void onAuthenticationFailed() { failedCount++; if (failedCount == maxFailedCount) { failedCount = 0; if (onFingerAuthListener != null) { cancelSignal(); onFingerAuthListener.onError(); } } else { onFingerAuthListener.onFailure(); } } @Override public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) { if (onFingerAuthListener != null) { cancelSignal(); onFingerAuthListener.onSuccess(); } } }; fingerprintManagerCompat = FingerprintManagerCompat.from(context); cancellationSignal = new CancellationSignal(); fingerprintManagerCompat.authenticate(null, 0, cancellationSignal, authenticationCallback, null); }
Example 2
Source File: FingerAuth.java From FingerAuth with Apache License 2.0 | 5 votes |
public static boolean hasFingerprintSupport(Context context) { FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat.from(context); boolean hardwareSupport = fingerprintManager.isHardwareDetected(); boolean secureSupport = true; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); if (keyguardManager!=null) secureSupport = keyguardManager.isKeyguardSecure(); } boolean hasPwd = fingerprintManager.hasEnrolledFingerprints(); return hardwareSupport && secureSupport && hasPwd; }
Example 3
Source File: MainActivity.java From journaldev with MIT License | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.button: managerCompat = FingerprintManagerCompat.from(MainActivity.this); if (managerCompat.isHardwareDetected() && managerCompat.hasEnrolledFingerprints()) { showFingerPrintDialog(); } else { Toast.makeText(getApplicationContext(), "Fingerprint not supported", Toast.LENGTH_SHORT).show(); } break; } }
Example 4
Source File: FingerprintUtils.java From FingerprintDialogCompat with Apache License 2.0 | 4 votes |
public static boolean isFingerprintEnroled(@NonNull final Context context) { FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat.from(context); return fingerprintManager.hasEnrolledFingerprints(); }
Example 5
Source File: Utils.java From always-on-amoled with GNU General Public License v3.0 | 4 votes |
public static boolean hasFingerprintSensor(Context context) { FingerprintManagerCompat manager = FingerprintManagerCompat.from(context); return manager.isHardwareDetected() && manager.hasEnrolledFingerprints(); }
Example 6
Source File: FingerprintUtils.java From FingerprintDialogCompat with Apache License 2.0 | 2 votes |
/** * Check if the device have supported hardware fir the finger print scanner. * * @param context instance of the caller. * @return true if device have the hardware. */ public static boolean isSupportedHardware(@NonNull final Context context) { FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat.from(context); return fingerprintManager.isHardwareDetected(); }