2

I'm downloading 1 image from URL

   await dio.download(url, saveFile.path,
            onReceiveProgress: (value1, value2) {
          setState(() {
            progress = value1 / value2;
            print(progress);
          });
        });

This Works fine in Android 10 but not working in Android 11 Why ?

This is my exception:- FileSystemException: Creation failed, path = '/storage/emulated/0/4k unique wallpapers' (OS Error: Operation not permitted, errno = 1)

Though I had called this code in Manifest...

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

<application
    android:preserveLegacyExternalStorage="true"
    android:requestLegacyExternalStorage="true"
</application>
Vaibhav Pallod
  • 466
  • 7
  • 21

1 Answers1

0

I came here via the GitHub Issue on the Permission Handler plugin. It worked on Android 10, but not on Android 11 you said. Have you tried using the manageExternalStorage permission of the plugin you're using? In the manifest you should add this:

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

And of course you need to request() the permission.

Please read the documentation of the manage external storage, because Google needs to approve the usage of the manageExternalStorage. Let me know if this fixed your problem!