Tried to open .pdf file like
ElevatedButton(
onPressed: () async {
await OpenFile.open('/storage/emulated/0/Download/myqr.pdf')
.then((value) {
log(value.message.toString());
});
},
child: const Text("Open File"),
)
But not working.
It gives error: Permission denied: android.permission.READ_EXTERNAL_STORAGE
Already added permisions in AndroidMenifest.xml
<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"/>
Requested permissons:
Future askRequiredPermission() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.storage,
Permission.manageExternalStorage,
Permission.accessMediaLocation
].request();
3
Answers
You need these permissions for Android 13:
On an Android 13 device you will not ask for permission READ_EXTERNAL_STORAGE.
You have it automatically for files created by your app.
Use this approach with permission handler https://pub.dev/packages/permission_handler :
In manifest only :