joutvhu / open_file_plus

A plug-in that can call native APP to open files with string result in flutter, support iOS(UTI) / android(intent) / PC(ffi) / web(dart:html)
https://pub.dev/packages/open_file_plus
BSD 3-Clause "New" or "Revised" License
5 stars 11 forks source link

can't open file in android 13 #7

Closed ninehichem closed 1 year ago

ninehichem commented 1 year ago

when using it with android 13 device can't opena file i get this error : Permission denied: android.permission.READ_EXTERNAL_STORAGE

my permissions :

<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<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"/>

this is the code:

static Future openFile(File file) async { final url = file.path;

 if(await Permission.manageExternalStorage.isGranted && await Permission.storage.isGranted){
  await OpenFile.open(url).then((value) => print('value == ${value.message}'));
 }else{
  await Permission.manageExternalStorage.request();
  await Permission.storage.request();
  await OpenFile.open(url).then((value) => print('value == ${value.message}'));
 }

}

i asked for permission using permission handler and stil get the same error, it work in android 12 and below. please if its possible i really need a solution max this week for my project. thanks

joutvhu commented 1 year ago

Fixed in version 3.4.1

ninehichem commented 1 year ago

@joutvhu Thanks a lot