7

If fingerprint scanner is available let user use my apps feature by authenticating with fingerprint.

2 Answers2

18

Try this code:

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 
}
Yev Kanivets
  • 1,780
  • 3
  • 22
  • 38
0

Try hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) on a PackageManager instance (you can get one from calling getPackageManager() on any handy Context).

Aiuspaktyn
  • 970
  • 1
  • 13
  • 16
  • 6
    looks like a copy of @CommonsWare response, http://stackoverflow.com/a/35302139/869451 – efeyc Oct 24 '16 at 09:29