Right way to ask for permission in android 11+

This is my scenario.

I have an app. I am using customwebview and want to download files using it. But the WRITE.EXTERNAL.STORAGE permission is not working in Android 11+ Now how can I ask for download folder permission / storage permission to save any file on the device? Previously I was using MANAGE.EXTERNAL.STORAGE and then the Google Play Console team rejected my app. So what’s the solution.

There is no need to ask for any permission if you are downloading files to /Download folder.

But it fails then. Using your customwebviewer and download helper. It just got failed everytime without permissions, I believe. I will share the block image in a minute.

Checkout this…

I will try again but the apk is not building. So have to wait and then I will share you the apk you can check.

Remove all those AskForPermission blocks…
What happens? Try in companion and as apk file… and before testing remove all previously stored test files in the /Download directory… Is the file there after trying to download? Any error message?

Taifun

As usual, I have forgot what kind of input downloadDir requires.
So try some other options.
Downloads
Download
/Downloads

If you are using latest version and want to download to ASD then just prefix ~ to any dir. ( ~Downloads )

I am trying in companion and getting these issues…

Unable to build apk because its saying " Version couldn’t match or something "

This is all you need, Companion & APK, with AI2 or Kodular:

2 Likes

It is for versions less than 30. And if I am not wrong greater than 30 don’t need permission to download anything in the download folder.

I have configured this, but there are some errors still. I will share it here.

No issues. It fixed. Thanks @vknow360 @bodymindpower @Taifun