Open AndreLuizNogueira opened 2 years ago
Hi @jerckov40. I still trying to figure out how to make this work on Android 11.
Did you try to declare this permission on your App?
I cant add, It is restricted. why is the lib using manage instead of read ? With open_file It uses read_external...
AFAIK, there is no permissions declared anymore on the LIB.
When I asked about adding the permission on your side, I meant for testing only, not indefinitely.
On the example app, there is only a READ permission declerade. There is no MANAGE permission there.
Sorry, misunderstood. i am currently on half of a new feature in my app, I will test later today and report back
Just tested, same error.
I will have to spend more time understanting this MANAGE permission and file access on Android >= 11.
if it helps, my phone is a POCO X3 NFC 64GB, I just updated to android 12.
my environment:
[√] Flutter (Channel stable, 3.3.2, on Microsoft Windows [versÆo 10.0.22000.978], locale pt-BR) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.5) [√] Android Studio (version 2021.3) [√] Connected device (4 available) [√] HTTP Host Availability
Tools • Dart 2.18.1 • DevTools 2.15.0
today google declined my app for using the old Open_file lib, so I came up with this workaround for using this lib on Android >= 11, just copy your file to temp folder when oppenning; like this :
var result = await OpenFile.open(filepath); if (result.message.toUpperCase().contains('MANAGE_EXTERNAL_STORAGE')) { final filename = filepath.split('/').last; final String newpath = '${(await getTemporaryDirectory()).path}/$filename'; await File(filepath).copy(newpath); result = await OpenFile.open(newpath); }
I just Changed from Open_file and can't open files on ondroid 11, permission denied error.
The File is a pdf in my Documents folder, and I was able to open in Open_File.
file: /storage/emulated/0/documents/My App/test.pdf
Permission denied: android.Manifest.permission.MANAGE_EXTERNAL_STORAGE