Adithya.K
Adithya.K

Reputation: 303

Need FingerPrint scanning for those which have that feature and for rest it should not display that option

I am trying to display fingerprint unlock in my application! I am using the following sample

[1]: https://github.com/googlesamples/android-FingerprintDialog

It works but unable to get it into my code! Im getting compile error for

"ObjectGraph"!

My application should show a popup when there is a fingerprint option available and only if the user has already activated the fingerprint option if available on his phone! The sample works for only version:23. Please suggest me what im missing anything or any sample code please!!

Upvotes: 0

Views: 48

Answers (1)

Jehy
Jehy

Reputation: 4899

This sample clearly states that it is available only for Android SDK v23+. Fingerprint api appeared only in this version of SDK: https://developer.android.com/about/versions/marshmallow/android-6.0.html

So check Android SDK version and don't display fingerpring option for 23-. Also you need to check if hardware fingerprint sensor is available with isHardwareDetected function of FingerprintManager: https://developer.android.com/reference/android/hardware/fingerprint/FingerprintManager.html

Code sample:

FingerprintManager fingerprintManager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
if (!fingerprintManager.isHardwareDetected()) { 
  // Device doesn't support fingerprint authentication     
} else if (!fingerprintManager.hasEnrolledFingerprints()) { 
  // User hasn't enrolled any fingerprints to authenticate with 
} else { 
  // Everything is ready for fingerprint authentication 
}

Upvotes: 0

Related Questions