5

I used this library https://github.com/Dhaval2404/ImagePicker and I got a warning from the android play console, team We've detected that your app contains the requestLegacyExternalStorage flag in the manifest file of 1 or more of your app bundles or APKs. Developers with apps on devices running Android 11+ must use Scoped Storage to give users better access control over their device storage. To release your app on Android 11 or newer after May 5th, you must either: 

Zain
  • 37,492
  • 7
  • 60
  • 84
  • Hey @blackapps my question is related to android permission to pick an image from the gallery for all android version till android 11 But I don't know what is the correct way to implement or fix my problem – Vishal kumar singhvi Apr 23 '21 at 12:59
  • To pick an image from 'the gallery' you do not need any permission or flags to begin with. Not for any Android version. So what is your problem? – blackapps Apr 23 '21 at 13:05
  • @blackapps without gallery if we are picking image from storage that time we need permission right – Vishal kumar singhvi Apr 23 '21 at 13:12
  • It is unclear to me what you are doing while 'picking an image from storage'. And if you change the subject then adapt your text too as the gallery is still there. Start with writing a to the point post. – blackapps Apr 23 '21 at 13:13
  • @blackapps I need little bit help for you . – Vishal kumar singhvi Apr 23 '21 at 13:15
  • I used this library https://github.com/Dhaval2404/ImagePicker and I got a warning form the android play console, team We've detected that your app contains the requestLegacyExternalStorage flag in the manifest file of 1 or more of your app bundles or APKs. Developers with apps on devices running Android 11+ must use Scoped Storage to give users better access control over their device storage. To release your app on Android 11 or newer after May 5th, you must either: – Vishal kumar singhvi Apr 23 '21 at 13:16
  • 1
    Well then make a different subject and start your post with your last comment. – blackapps Apr 23 '21 at 13:19
  • And why dont you use ACTION_GET_CONTENT or ACTION_OPEN_DOCUMENT to pick images? No permissions or flags needed. – blackapps Apr 23 '21 at 13:21
  • Okay, I will try both intents. Have you used for pick image using these intents ?@blackapps Thanks a lot!! – Vishal kumar singhvi Apr 23 '21 at 13:28

2 Answers2

-1
  • Before Android 10, we have a concept of Shared Storage. Every application in the device has some private storage in the internal memory and you can find this in the android/data/your_package_name directory. Apart from this internal storage, the rest of the storage is called the Shared Storage i.e. every application with the storage permission can access this part of the memory. This includes media collections and other files of different applications. But the problem is that the application having the storage permission doesn't require access to all of these files. All they want is to perform some small operation over some small part of the memory and that's it. For example, some application just needs to select a user image to upload it as the profile picture and nothing else. So, why provide them with full access to that Shared Storage?

  • Also, the second problem is that when the application is having such a wide writing capability on the storage then the files generated by the application gets scattered and when the user uninstalls the application then the files generated by the application remains in the storage only and are not deleted and takes a lot of space.

  • So, we need some kind of mechanism, with the help of which the apps can get the specific access they need without getting such a broad reading and writing power that they don't actually need. This can be done with the help of Scoped Storage.

Note:- From Android 11 onwards googles forces to used Scope Storage Check This Link

Krishna Sony
  • 1,286
  • 13
  • 27
-1
<queries>
<intent>
    <action android:name="android.intent.action.PICK" />
</intent>

Don't forget to put queries tag in your manifest file. use this code in your manifest file...

Yahya M
  • 392
  • 3
  • 13