Error while copying a file from assets to device

How big is yours mp3 files and if you plan to have large files then you will have to download the files at some point

Btw, did you try my blocks above or the test aia as it works for me

/Boban

1 Like

Yes, it should work that way, as Boban said.
But maybe you forgot to ask for WRITE_EXTERNAL_STORAGE permission first. Because you write in the external storage.
(Companion does not need this permission, only the APK)

See Taifun’s File extension description:

2 Likes

Note : WRITE_EXTERNAL_STORAGE is sufficient as it implicitly grants READ permission.
So no need to ask for READ permission.

grafik

2 Likes

It worked!!!

Thanks for all your help!!! ONT Studios, Stiaen, Boban and Bodymindpower!!!

Here is my final “code”:

When I’m using the companion, the copy doesn’t work. But in the APKs it works fine.

I even added a share component and it worked fine (here I needed to use the whole directory, as stated by Ontstudios).

I’ll leave the AIA file, so anybody can use it. :slight_smile:

Yeah.aia (60.0 KB)

3 Likes

That’s strange

/Boban

2 Likes

my guess is, this is because for the companion app Kodular unfortunately does not use the/AppInventor folder, but a /Makeroid folder?
see also

@Boban, are you saying, the Copy method works fine for you using the companion app of Kodular?

Taifun

3 Likes

the final blocks should look like this


important: share the file after it has been copied… to share it before it has been copied completely might be the issue you currently have…

Taifun

3 Likes

Yes it does, on Samsung Note8 Android 9

I can also test with my other phones/versions just to make sure it works even on them

/Boban

2 Likes

That makes a lot of sense!

The copy only works with the apk. I’ve tried soooo many times with the Companion and it never worked.

Oh, I’m using a Moto G Android 6.0

Alright, thanks!!!

That would be amazing!! Thanks a lot! :slight_smile:

Btw, I’m aware that I’m pretty new to this Kodular world and something might have slipped under my radar. I really hope I’m not doing some extremelly silly mistake and making you guys waste your time in here! :slight_smile:

I tested also an a Galaxy Note8 Android 9 and for me it does not work.
So I made some adjustments:


Yeah2.aia (61.1 KB)

see also here:

2 Likes

Don’t know why it doesn’t work for you, this is what I get

bild

Edit: Ignore my answers as I figured out why it works for me, a clue using multiple builders

/Boban

1 Like

Are you absolute sure that this folder / path does not exists on your device?
/mnt/sdcard/AppInventor/assets/

and also that this file does not exists:
/mnt/sdcard/AppInventor/assets/WooHoo.pdf

If this folder exists on your device, delete it and try again.

2 Likes

That’s what I wrote above

/Boban

1 Like

ok, I am too late

Never liked that folder change from AppInventor to Makeroid as you get so confused

/Boban

2 Likes

So, trying to summarize the whole thing: the copy will work fine with the APK but won’t with the Companion (because the folder new name).

That’s it?

No, it should also work with Companion the way I have shown, so test my aia: Yeah2.aia (see above).

1 Like

hmm
Didn’t work here.

But I have a ideia why your example isn’t working here:

2

It’s searching in the external card, right? I don’t use it.

no, this is the correct path for the Kodular companion app to find a file in the assets…
thank you @bodymindpower
so my guess was correct. I will add a note in the documentation of the file extension

exactly, that was a bad decision…

Taifun

2 Likes

Yes, but the wrong path for APK. I checked it again (only “//” work for APK):


Same thing on AI2.

Companion or APK?

1 Like