Page 1 of 1

How to save XML file to SD Card

Posted: Sat Aug 25, 2018 5:49 pm
by Texter
Hello

I found many informations on the internet about this problem but nothing works.
Maybe someone can help me.

My app is creating a XML file and I can save it on my Android Tablet to the internal storage with this code.

put textencode(tXMLFinal,"UTF8") into URL ("file:/mnt/sdcard/documents/Test.xml")

I am confused about this, because I use sdcard and the file is not on the sd card. It is on the internal storage.
I tryed different code with sdcard2, external and so on, but nothing!

How can I solve this problem.

The app is on Android 4.1, the Tablet is Android 7
But I think this should not be the problem.

Thanks Texter

Re: How to save XML file to SD Card

Posted: Sat Aug 25, 2018 6:13 pm
by Klaus
Hi texter,

try -> specialfolderpath("external documents")

Code: Select all

put textencode(tXMLFinal,"UTF8") into URL ("file:" & specialfolderpath("external documents") & "/test.xml")
From the dicitonary about specialfolderpaths on ANDROID:
...
"external documents": The folder on the primary shared/external storage device where application-specific data can be placed
...
Note: If using any external folderIdentifier values, ensure you have the 'Write External Storage' permission checked in the application standalone settings
...

Hope that helps.


Best

Klaus

Re: How to save XML file to SD Card

Posted: Sat Aug 25, 2018 6:55 pm
by Texter
Thank you Klaus

I will try it tomorrow

Re: How to save XML file to SD Card

Posted: Sun Aug 26, 2018 7:35 am
by Texter
Hi Klaus

I tried the code with external documents but the file was saved in

/storage/emulated/0/Android/data/com.yourcompany.yourapp/files

in the internal storage of the Tablet

Dont know whats the problem

Texter

Re: How to save XML file to SD Card

Posted: Sun Aug 26, 2018 6:15 pm
by Klaus
Hi texter,

I do not own any mobile device (no cellphone, yep, that's me :-)), so I can only be of theoretical help.
Did you check "Write external storage" in the standalone builder settings for Android?


Best

Klaus

Re: How to save XML file to SD Card

Posted: Sun Aug 26, 2018 6:39 pm
by Texter
hello Klaus

Setting for write external storage is checked.

But until now I could only save to internal storage.

I have no idea how to change this.

Thanks Klaus

Texter

Re: How to save XML file to SD Card

Posted: Sun Aug 26, 2018 10:25 pm
by jacque
Try setting the Install Location to "Prefer external storage". If that doesn't work you'll need to figure out the path to the SD card. Unfortunately that will vary depending on the device or the manufacturer.

External SDCard file path for Android:
https://www.google.com/url?sa=t&rct=j&q ... 6axni_r5Ki