I’m a beginner in development. I have to add a feature to allow users to select images from the internal storage.
I want to know if the permission asking code must be written to this feature. If I don’t write it, will the playstore raise a red flag when the user installs the app?
Thanks
2
Answers
If you don’t request the appropriate permission, the app won’t be able to perform the request – it will just fail.
You should ensure that you include the appropriate permissions in your manifest.
I believe that if you use the
image_picker
plugin provided by flutter, it should already handle this for you (for android at least, iOS needs stuff added to the info.plist). This is generally the recommended way of selecting an image, rather than writing code to read files directly from storage.The plugin is automatically adding something like this to your manifest:
If you were to be using images from the storage directly, you’d need to do something like this:
and then request the appropriate permissions at runtime using something like
permission_handler
.However, on android > 12, the MANAGE_EXTERNAL_STORAGE permission is considered high-privilege, so you would need to justify why it is required to get the app released. And it’s the kind of permission that doesn’t give a simple popup but rather requires the user to toggle it on in the settings.
You do not need any permission to let the user choose pictures from your device.