Reputation: 33
Is it always safe to use the path "/storage/emulated/0/{MY APP NAME}" to store the files ?
I Want to store files in the external storage of the android device and I want to store it in a folder named after the app name this folder needs to be located in the external storage.
Upvotes: 3
Views: 8282
Reputation: 4725
Check this thread.
The directory
an app can access on sdcard looks like /storage/1718-0217/Android/data/com.example.app_name/files
. You can get this with the code below.
(await getExternalStorageDirectories())?[1].path;
One app should only access some restricted directories on sdcard. Or you should use Permission.manageExternalStorage.request()
, it is strongly restricted and always return false.
Fortunately, per-app directories can also be scanned by other services such like media
.
Upvotes: 0
Reputation: 1285
try the same package of ext_storage named android_external_storage its the same concept putting the downloaded data for example to the download folder.
Upvotes: 0
Reputation: 3570
Have you tried the package path_provider
https://pub.dev/packages/path_provider/install?
It comes with the methods getExternalStorageDirectory()
and getApplicationDocumentsDirectory()
which might be what you are looking for. As far as I know different os types are automatically considered as well.
Upvotes: 1