Hi to All.
After many unsuccessful trials, I decided to submit to the community my problem which concerns accessing a File.DirRootExternal subfolder. Of course, my old apps worked well before, while now they crash with:
java.io.FileNotFoundException: /storage/emulated/0/Smas/ListaCaixaN_UTF-8.txt: open failed: EACCES (Permission denied)
This topic is treated many times in this forum, and apparently definitive workarounds exist. I have followed these workarounds, added permission requests to Manifest and used the top information existing here, namely an Erel post, concerning the access to DirRootExternal. I attach a project showing what I did. The background is: I need to pre-load one or more files to be read by the App. The ideal place for such files is not the Folder related to the App itself, namely: Internal_Memory/Android/data/App_related_folder/files/. This folder is destroyed if the App is uninstalled (correct me is wrong). The ideal place is a folder which must be accessible also by other Apps and survive to eventual uninstallation. Therefore, connecting the Phone with a cable to the computer, I created a folder as in the attached picture. The folder name is "Smas". Then I copied an ascii txt file inside that folder (not attached, but not important: any file may be used). Trying to access the file, with the attached project, fails.
Moreover the workaround to use RuntimePermission.GetSafeDefaultDir instead of FileDirRootExternal has another drawback: while the subfolders are accessible with a cable connection, the same is not true running an Ftp server on the phone (at least this is my impression). So, in practice, I can manage the pre-loaded files there, with the cable, but not with Ftp. Even, with Ftp connection, it seems that the subfolders internal to the" Android/data/App_related_Folder/files" are not visible. The "Android/Data" folder appears to be empty.
Thanks in advance.
After many unsuccessful trials, I decided to submit to the community my problem which concerns accessing a File.DirRootExternal subfolder. Of course, my old apps worked well before, while now they crash with:
java.io.FileNotFoundException: /storage/emulated/0/Smas/ListaCaixaN_UTF-8.txt: open failed: EACCES (Permission denied)
This topic is treated many times in this forum, and apparently definitive workarounds exist. I have followed these workarounds, added permission requests to Manifest and used the top information existing here, namely an Erel post, concerning the access to DirRootExternal. I attach a project showing what I did. The background is: I need to pre-load one or more files to be read by the App. The ideal place for such files is not the Folder related to the App itself, namely: Internal_Memory/Android/data/App_related_folder/files/. This folder is destroyed if the App is uninstalled (correct me is wrong). The ideal place is a folder which must be accessible also by other Apps and survive to eventual uninstallation. Therefore, connecting the Phone with a cable to the computer, I created a folder as in the attached picture. The folder name is "Smas". Then I copied an ascii txt file inside that folder (not attached, but not important: any file may be used). Trying to access the file, with the attached project, fails.
Moreover the workaround to use RuntimePermission.GetSafeDefaultDir instead of FileDirRootExternal has another drawback: while the subfolders are accessible with a cable connection, the same is not true running an Ftp server on the phone (at least this is my impression). So, in practice, I can manage the pre-loaded files there, with the cable, but not with Ftp. Even, with Ftp connection, it seems that the subfolders internal to the" Android/data/App_related_Folder/files" are not visible. The "Android/Data" folder appears to be empty.
Thanks in advance.