Skip to content
This repository was archived by the owner on Aug 26, 2019. It is now read-only.

Conversation

@sorz
Copy link
Contributor

@sorz sorz commented Mar 22, 2017

As per discussion in #242,

  • Catch SecurityException in FingerprintManager.hasEnrolledFingerprints()
  • Display error message on AuthenticationError.

FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class);
// The line below prevents the false positive inspection from Android Studio
// noinspection ResourceType
if (fingerprintManager.hasEnrolledFingerprints()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method might make the code clean.

@RequiresApi(api = Build.VERSION_CODES.M)
public static boolean hasEnrolledFingerprints(FingerprintManager fp) {
    try {
        return (fp != null) && fp.hasEnrolledFingerprints();
    } catch (SecurityException e) {
        // Some Samsung devices throw this on hasEnrolledFingerprints().
        return false;
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants