How to save a file in the external sdcard?

Salve, devo salvare un file csv nella Sd Card External del mio Samsung S7Edge tramite un Activity Starter ma non trovo la soluzione.
Se uso il blocco File, mi salva il file csv nella memoria interna del cellulare.
Non sono riuscita a trovare informazioni in merito, qualcuno mi può aiutare, grazie.

the higher the Android version of your device, the less likely you will be able to do it
see also the notes below the Copy method here App Inventor Extensions: File | Pura Vida Apps

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

This example uses the @Taifun extension:
https://puravidaapps.com/file.php

  • You write in the TextBox a file name of the asset (uno.txt, kio4.png, gato.mp3) and choose in which SdCard you want to save it.

guardar_SdCard2

Guardar_SdCard.aia (92.2 KB)

1 Like

Nice try @Juan_Antonio . NIce effort, but

:frowning: Thanks anyway. This fails on a Samsung A10 Tablet, Android 8.1 will try it again on a 4.2.2 tablet later

– Steve

Grazie per la risposta, ciao.

Grazie per la risposta.

The external (removable) SD card can only be read (since Android 4.4, KitKat).

See also here:

Grazie Anke

It depends on the device.

My mobile is a Redmi 7 Xiaomi (not rooted) with Android 9.
My removable SdCard is an 8 GB microSdCard.
My Guardar_SdCard app is installed (Build) on the mobile.

In my new app I have added my extension: KIO4_Terminal, you can execute LINUX commands mkdir, cp, rmdir, …
In my Xiaomi - Android 9 I can create, delete directories … in the removable SdCard.
http://kio4.com/appinventor/278_extension_shell.htm

  • My extension KIO4_Terminal does not return a response.

removablesdcard Guardar_SdCard_2.aia (100.6 KB)

2 Likes

Thanks for the information Juan Antonio. Yes, it does depend on the device as to what works.

I built the app. The app copies to /storage/emulated/0/ fine. It does not store to the physical sd Card on my Samsung Android 8.1 Tablet . I checked Settings>APPS>//Guardar_SdCard_2>Permissions ; the Storage indicates permissions are set. Screen1.AskForPermission WRITE_EXTERNAL_STORAGE works (since the app does have the permission), but the device does not allow writing.

Great this works on Android 9; it is still not working on the external sdCard (works fine on the 'internal sdCard).

Your code and extension does create/delete directories on the internal sdCard. Thanks. :slight_smile:

Using the KIO4_Terminal.aix extension I have executed the LINUX: mount command to check how the SdCard is mounted on my Xiaomi 7 mobile (Android 9)
mount

I get that mount is of type sdcardfs

Then I install the same SdCard on a Huawei 9+ (Android 6) and I get a type fuse mount. (I cannot create directories on a removable SdCard with this mobile)

Perhaps it is the type of mount fuse vs sdcardfs that allows or not, to be able to write to the removable SdCard.

borrar_terminal.aia (8.0 KB)

1 Like

Great job, Juan !!!
I tested it on a Xiaomi Redmi Note 5 (Android 9) and it really works!
But unfortunately not on a Galaxy Note8 (Andorid 9).

When I run borrar_terminal.aia on Note8, I get the following result (Label1.txt):

Label1.txt (7.4 KB)

@Anke, is the information you get from “Do it” different from what you get on the Label1 Screen?

I don’t think so. I only attached it for better reading.

No, I just copied & paste it.

OK.

Mount type is sdcardfs

/mnt/media_rw/9C33-6BBD on /storage/9C33-6BBD type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)
/data/knox/sdcard/150 on /storage/emulated/150 type sdcardfs

Yes I have seen it:

And now ...

This is from my Xiaomi Note 5: