Create a folder and move a photo into it

The photo is stored in the ASD - application specific directory

To copy it to shared storage, use the file component and its Copy method

From scope is App
From filename is the image you get in the AfterPicture event
To scope is Shared
To filename is for example /Download/myPictures/myPicture.jpg

Just try something and if you got stuck, post a screenshot of your relevant blocks

See also Some basics on Android storage system

Taifun

1 Like

To make sure we're talking about the same thing, first take a look at the guide @Taifun mentioned (especially regarding "External Storage": SD card, removable/micro SD card, ...).

@Anke Thank you for clarifying...

There are several topics that are restricted to PUs only...

https://community.appinventor.mit.edu/t/learning-discourse/55/6

It is quite frustrating to come across this. The poor self-taught user, who is not formulating insipid questions with each step or with each challenge and seeks information on the Forum, finds out that he cannot advance because there is privileged or elitized information to which he does not in access. Sad.

@>-->---

Well, there are good reasons why some topics are not posted publicly, but are discussed/clarified internally within the PUs to avoid additional confusion among users.

But you are right in that there are also topics where the result of an internal PU discussion would have been helpful for other users as well.

1 Like

My last post in this "PU topic":

So I tried to make this topic public (but it wasn't mine).

1 Like

What exactly prevents you from following my suggestion?

Taifun

Nothing.

@>-->---

...if the DefaultFileScope is set to "App". If it is set to "Shared" the picture is saved in the Shared folder /Pictures.

2 Likes

Ok, great...
So in case you need more help, then just provide a screenshot of your relevant blocks

Taifun

1 Like

Now moved to General Discussion, so should be visible to all. (As PU you could have done this)

(We will never be able to find it again now :wink: )

1 Like

As I said

And I won't do anything like that without the OP's (author's) permission. :smiley:

I tried this, I don't really know how to use the Copy method because it says in the documentation that it is a boolean and I joined it in a conditional block without having much idea why. By the way, the link to Anke's tutorial is very good. I would be in the case of a microsd. I have tried several folder managers, but they have me a little confused because they say that the root of my microsd is /storage/6539-3263/ but if I go to the root of the file system, inside /storage there is only one folder, which is emulated/ I don't really know why?
Anyway, these are the blocks I have tried and the error I got:


blocks

Because your microsd is not in your device's root file system

I thought it would be mounted inside /storage or inside /mnt. In linux everything hangs on /.

Whilst I agree with you, android does not present it that way, and you can't see it in /storage/.

  1. You cannot save a file to a removable SDcard since Android 4.4 (API 19, KitKat).
  2. The File component requires a relative path (with DefaultFileScope to the ASD and with Legacy to the root directory of the external storage).
1 Like

I have Android 14 on my phone. Are you telling me that there is no way to save a file to the micro SD expansion card? Is it a limitation of Android or AppInventor? How do other apps do it? Because I have several that write their data there. Or do you have to request permission or take another route to do the task?

Anyway, are the blocks used correctly as I mentioned above to capture an image and save it to disk? When you take the photo, it is already saved to disk, right? It doesn't stay in RAM or something like that, right?

Thank you for your patience.

1 Like

No, as I said the File comp. needs/uses a relative path.

Thanks, Anke. Now it works by saving the image to the internal memory folder. Now I have another problem, when I compile to an APK, the path changes and it stops working, obviously. I notice that now the path includes my mobile user in its string, if I install it on a different mobile, it will have another user and it will not work. Is there any way to get the username to get around this problem?


In segment block there is: file:///storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files