'Deprecated permissions om Android

I'm setting up an Android projects with biometrics and it turns out that the Biometric permissions have been replaced in API 28.

How should I declare my manifest as, given that we have to use the principle of least privilege.

<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />

or should it be

<uses-permission android:name="android.permission.USE_BIOMETRIC" />



Solution 1:[1]

According to the new policy in Google Console, you couldn't use this permission on the Manifest. So you should Request and Check in Activity.

API< 28:

ActivityCompat.checkSelfPermission(this,
                Manifest.permission.USE_FINGERPRINT) ==
                PackageManager.PERMISSION_GRANTED)

API >= 28:

ActivityCompat.checkSelfPermission(this,
                Manifest.permission.USE_BIOMETRIC) !=
                PackageManager.PERMISSION_GRANTED)

           

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1