Android Question Issue writing SD card on Android 5

tigrot

Well-Known Member
Licensed User
Longtime User
Hi everybody,
I'm struggling with creating a directory on SD.
B4X:
Dim lista As List=File.ListFiles("/storage/sdcard1")
For Each e In lista
    Log(e)
Next   
File.makedir("/storage/sdcard1/Android","")

lista shows correctly the content of SD card on a Android 5. I try to create the structure:
"Android/data/it.logicdata.cncfiler/files" but I didn't succede(no error, simply directory is not created)
Also creating "Android" only obtains same results.
On 4.2 is OK.
Here is the relevant code for manifest
B4X:
AddManifestText(
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
)

Does somebody knows why?

Thank you!

Mauro
 

tigrot

Well-Known Member
Licensed User
Longtime User
I can get it also if it was not created?
I have just tested that in case I create the "supposed allowed" folder every successive creation inside of it run fine. I have also created files for sql lite and a folder in it.
Thank you...
Mauro
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Strange things happen here. The RuntimePermissions.GetAllSafeDirsExternal returns only one element(the SD emulated in internal memory) not the SD.
B4X:
Dim aa As RuntimePermissions
Dim paths() As String=aa.GetallSafeDirsExternal("")
/storage/emulated/0
Dunno if the issue is in my LG X150, but using my app I'm not able to create the structure to write permanent data on SD

Ciao
Mauro
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Yes, Erel seems to be my case. At least I have found this problem before release. The problem is: How can I create the structure Android/data/"app id". I'm not able to create also a single level of folders. I'm testing other ways...
Thank you again!
Mauro
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Hi Erel, seems to be impossible to create (mkdir) the structure "/storage/sdcard1/Android/data/it.logicdata.cncfiler/files" after creation I'm able to create anything inside of it, both dirs and files. Definitly a bug or something that seems to be. I have tested QuickEdit which asks the permission to write to sd and then it can create a file on root. My app has full permissions for external storage.
 
Upvote 0
Top