Search code examples
androidandroid-studioandroid-fingerprint-api

Android Studio complains about missing permission check for Fingerprint sensor


I have the following code-lines:

    FingerprintManager fm = activity.getSystemService(FingerprintManager.class);
    fm.isHardwareDetected();

At this Point, Android Studio complains about a missing permssionCheck (checkSelfPermission).

Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException

However, as I understand the Documentation, USE_FINGERPRINT (required by FingerprintManager) is not a "dangerous" permission and thus is granted at install time. If I suppress the AndroidStudio warning everything works fine on my test devices. Is this a bogus warning?


Solution

  • This clearly seems to be an AndroidStudio bug. I have added

    //noinspection MissingPermission
    

    to supress this warning, and there are no negative consequences.