For some reason i canot create a folder with a file on the internal storage. Even with the latest avaiable permission manager where i granted permission, it does not working. I read an articel (Android 13 - READ_EXTERNAL_STORAGE_PERMISSION still usable) that there is no need for asking permission if targetSdkVersion 33 is set?
compileSdkVersion 33 minSdkVersion 20 targetSdkVersion 33
Ive set the permission in Android Manifest:
android:requestLegacyExternalStorage="true"
This is my code:
Future saveQrCode({String? qrCode})async{
if(Platform.isIOS){
final Directory appDocDir = await getApplicationDocumentsDirectory();
final Directory appDocDirFolder = Directory('${appDocDir.path}/account/');
if ((!await appDocDirFolder.exists())) {
appDocDirFolder.create();
final File file = File('${appDocDirFolder.path}/qrCodeGenerated.txt');
await file.writeAsString(qrCode!);
}
}else{
final Directory? appDocDir = await getExternalStorageDirectory();
final Directory appDocDirFolder = Directory('${appDocDir?.path}/account/');
if ((!await appDocDirFolder.exists())) {
appDocDirFolder.create();
final File file = File('${appDocDirFolder.path}/qrCodeGenerated.txt');
await file.writeAsString(qrCode!);
}
}
}
On Ios everything works fine, only android shows no effect at all Does anyone have an idea? If you need more information, let me know! Thank you