Search code examples
androidandroid-galleryuser-permissions

How to set permission to device gallery?


i want select photo gallery in my app and used this code in manifest :

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
    android:permissionGroup="android.permission-group.STORAGE"
    android:protectionLevel="dangerous" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

but send this massage to allow access :

enter image description here


Solution

  • System permissions are divided into two categories, normal and dangerous:

    1-Normal permissions do not directly risk the user's privacy. If your app lists a normal permission in its manifest, the system grants the permission automatically.

    2-Dangerous permissions can give the app access to the user's confidential data. If your app lists a normal permission in its manifest, the system grants the permission automatically. If you list a dangerous permission, the user has to explicitly give approval to your app.

    So in your manifst you are asking for dangerous permissions, it's normal the device ask if you want to give that permission