RonSan
(Ron San)
August 22, 2019, 4:04pm
#1
Hello!
I’m trying to copy a file from my app assets, but it is no working.
Whenever I try to copy it, I always get the message: “Sorry, file to copy does not exist ”.
I’m using Taifun’s extension to copy the file.
I’ve been reading the forum (and App Inventor Extensions: File | Pura Vida Apps ) and I can’t understand why it’s not working.
To be sure that I’m not doing anything silly (like typos), I’m using the file testCopyDelete.aia provided by Taifun.
My screen:
My assets:
My blocks:
My phone’s screen when I click the button:
As you can see, I got that error saying that the file doesn’t exist.
I don’t know if it’s important, but I’m using a Moto G phone.
I’ll leave here the AIA file as well. If someone could help me, I will be forever grateful!
Test_forum.aia (41.5 KB)
Thanks!
1 Like
Mateja
(Mateja)
August 22, 2019, 4:07pm
#2
Nope, the text formatting isn’t correct. You should do:
/storage/emulated/0/{folder}/WooHoo.pdf
1 Like
RonSan
(Ron San)
August 22, 2019, 4:15pm
#3
Hi!
Are talking about the toFileName area?
Thanks, but my problem is that I can’t even copy the file from the assets folder.
Mateja
(Mateja)
August 22, 2019, 4:15pm
#4
Yes. Try first downloading the asset the copying it?
Stiaen
(Etienne LL)
August 22, 2019, 4:16pm
#5
Are you using the companion or an apk ?
1 Like
RonSan
(Ron San)
August 22, 2019, 4:19pm
#6
Well, Taifun’s text says that it works with the companion:
“… To copy assets packaged with an application (also works for the Companion) start the fromFilename with // (two slashes)…”
But no problem, I’ll try your idea! Just give me one minute!
1 Like
RonSan
(Ron San)
August 22, 2019, 4:26pm
#7
Nope. Even with the apk it’s not working.
Could you, please, try my AIA file and test if it’s working?
RonSan
(Ron San)
August 22, 2019, 4:28pm
#10
I’m sorry, could you say again? I didn’t get your ideia.
Mateja
(Mateja)
August 22, 2019, 4:28pm
#11
So, you want to copy an asset that is in your project file? (AIA)
1 Like
Stiaen
(Etienne LL)
August 22, 2019, 4:40pm
#13
As @Mateja the path is wrong, I’ve tested with the companion and it works fine.
Of course, when you use an apk the path is different…
1 Like
RonSan
(Ron San)
August 22, 2019, 4:40pm
#14
Yes, that’s it. I want to copy a file (mp3) when the user clicks the button.
But I always get the error saying that the original file wasn’t found (even that it IS in the assets folder).
Mateja
(Mateja)
August 22, 2019, 4:41pm
#15
Okay. But if the user runs the app via the companion, you need to put the toFileName text to:
/storage/emulated/0/Makeroid/{name of the file with format example: lol.mp3 }
or
/Makeroid/assets/file
Why? Because when connecting to the companion the console or whatever sends all the assets to the companion (your phone)
If the user is running the app from an installed APK file (everything else except the companion) then you first need to download the file from a website to the users phone using the Download component. Example:
How I got the https://bit.ly/testkdlr link. It is a direct download link, if you click it, you will instantly download a picture:
Upload your file to MediaFire
Open the link
Right click download, copy link location.
1 Like
Boban
(Boban Stojmenovic)
August 22, 2019, 4:43pm
#16
How about updating the extension, your test aia has version 2, newest version is 11
/Boban
1 Like
Boban
(Boban Stojmenovic)
August 22, 2019, 4:50pm
#17
And use this block
Test_forum_copy.aia (59.9 KB)
/Boban
1 Like
RonSan
(Ron San)
August 22, 2019, 4:58pm
#18
Well, that is quite a surprise!
I get this extension from App Inventor Extensions: File | Pura Vida Apps …
So, could you tell me where I can get the version 11?
Boban
(Boban Stojmenovic)
August 22, 2019, 5:02pm
#19
I just downloaded it myself as I had version 10 and yes that’s the link
In Kodular check your extension version
/Boban
2 Likes
RonSan
(Ron San)
August 22, 2019, 5:17pm
#20
Well, it worked. But this Makeroid folder is a folder created by the
Companion, right?
When I export the APK and sent it to someone else (who doesn’t have that folder), it won’t work, am I right?
As Ontstudios stated, I will need to download the mp3 from the internet first?
RonSan
(Ron San)
August 22, 2019, 5:24pm
#21
Hmmm, I understand your whole idea, but wasn’t the Taifun’s extension created exactly to do that? I mean, with this extension, we would be able to download files from the apk assets, right?