Writing to external SD card

I have an Android 6 phone on which I have created a directory “mydatalogger” on the removable sd card.
Can I create a file in it and send data to it from a Kodular app?
I have spent hours researching on this board but have not seen a definitive answer.

Advice please.

Hi welcome,
It can be done with file component
Read documentation:
https://docs.kodular.io/components/storage/file/#save-file

Did you asked read and write permissions

blocks (4)

blocks (3)

The file is created but appears under internal storage and not on the SD card.

Why don’t read documentation ?
it says:
Saves text to a file. If the filename begins with a slash (/) the file is written to the sdcard. For example writing to /myFile.txt will write the file to /sdcard/myFile.txt. If the filename does not start with a slash, it will be written in the programs private data directory where it will not be accessible to other programs on the phone. There is a special exception for the AI Companion where these files are written to /sdcard/AppInventor/data to facilitate debugging. Note that this block will overwrite a file if it already exists If you want to add content to a file use the append block.

1 Like

Change the component File1.Append To File for File1.Save File

Tried all that but it still only writes to the internal storage and not on the SD card.

All your tests were in companion ?

Yes in companion, so the file should have appeared in "/sdcard/AppInventor/data " but they are not just directly in the internal storage list.

:upside_down_face:

OK so all I read on the Kodula and App inventor forums tells me that it is not possible to write to the external SD card on my Android 6 phone. However I have a Bluetooth Terminal App which can do exactly that so I am confused.
http://www.kai-morich.de/android/

Anyway thanks for the help so far.

Jim