Asking for help with ASD storage deleting issue

Show us a Do it result of the path… it looks like a slash is missing…

use the companion app together with Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps

see also Live Development, Testing and Debugging

Also I think, you do not have to delete the file, just overwrite it…

Taifun

You were absolutely right. I am familiar with the “Do it” function, but forgot to to check between adding the join block and just with the call application specific directory. I did add the necessary slash to correct the code, but player is still not playing


I have also confirmed that the mp4 file did download fully (30.9MB) but activity starter not playing

one of the issues that I am facing is the “Behaviour” that occurs between the android 13 phone ( i am designing in android 10, api 29) and the android tv box. As an example, Player_One.mp4 button/blocks


do work for the android 13 version, although there is a 602 error due to 2 activity starter blocks, but when added in this fashion, after error disappears, The mp4 “streams” in and is never saved to the device, but when i attempt to run this apk on the android box (still a 602 error), it opens a web browser, similar to the web view component, shows the file being downloaded automatically (due to integration with google drive api), but then requires interaction by clicking on “do you wish in install this?.” default KD player then plays mp4 on android box after clicking yes. i can remove this 602 error simply by adding a second activity starter, but what i am trying to show is that from the root storage, it is possible to play/stream immediately an mp4, but can never change that file name/delete/over right, etc. due to android security with deleting files. thats why i am attempting instead with asd to get this working. does not seem that the activity starter can start events if they are stored in a asd.

Shouldn’t that be ActivityStarter2?

Taifun

What happens if you try the videoplayer component instead of the activity starter?
Taifun

Yes. these blocks were just in back pack because I know that they work (to a point, but still require too much interaction on the end user part.) there is not an issue with player, other than i need to change back activity starter to 2. the issues are still with player 2 and 3


if you notice, player two blocks work perfectly to have mp4 play/stream into phone, so does player three, but ONLY if i change the file to a custom download location.

if i attempt to use asd, whether its the Taifun or ASD downloader1, it does create the folder and download the mp4 to an ASD, but does not “Play” mp4 like player 1 would. neither does the delete function work to remove prior player. I tested this by running the code, downloading an mp4, then uploading a different mp4 to the google api drive, but this new mp4 does not download and original mp4 is not replaced.

test (1).aia (80.8 KB)

if you download and try to run the aia you will see players 1 and 2 working, player 1 does have a 602 error, but we know thats because of 2 activity starters. in both cases, player 1 (streams/never saves/ downloads to phone) and player 2, both play file

ok… yes, other apps can’t access the ASD of your app, so when you want to use the activity starter to play the video, then it must be stored in shared storage
sorry, I haven’t seen that earlier…
Taifun

No problem! if you can think of anything, please let me know. Ive spent about a month on and off trying to figure this on out…Its definitely a unique application between ASD and video/slide show for a kiosk screen. Thanks again

If you want to use the activity starter, then the video must be stored in shared storage and NOT in ASD

Taifun

Thank you. Im still wondering why the ASD directory does not delete and download the updated mp4. you mentioned that i could probably overwrite the file, but this would just produce another file in ASD-Player_three.mp4(1), then Player_Three.mp4(2), Player_Three.mp4(3),etc. If I could figure out an app to access the ASD, then I would still need to do something with the naming convention so that the correct/updated mp4 file played. deleting these files first is important since each mp4 would be about 1gb. I will need to research permissions, but my understanding is that I could ask permissions to allow files in android shared storage to be deleted-i think Android 9 or less. What if the app was designed in a lower version of android, do you know what is the minimum level needed for the Taifun extension to work?

It looks like this is a feature of the extension you are using

Let me suggest the following workflow:

  1. Download the file to ASD
  2. Move the file to shared storage
  3. Play the file

Alternatively

  1. Download the file to shared storage
  2. Play the file
  3. Before downloading again, delete the file

Taifun

I definitely agree this would be a solution as the the first player already downloads to local storage, then the activity starter will play that mp4. this works great on an android 13 phone, but not on a android 10 tv box. when the app is installed and loaded onto the android box, the player one link opens a web browser, similar to the web viewer component on a phone. it downloads the file, but then has to be manually played/installed by selecting the downloaded file. player two works as it should, both on the phone and for the tv box. when player two is clicked, the file downloads into local storage, then is AUTOMATICALLY played. this is a perfect solution to what i am attempting to achieve. The problem with this method is as you said, i need to be onsite to first delete the prior Player_Two.mp4, prior to downloading the update mp4 otherwise the next download is named Player_Two.mp4(2) and the activity starter would to be pointing to Player_Two.mp4, not the updated mp4. i was trying to do this in a more automated way. when the end user wanted the new mp4 played on their kiosks, they would simply exit, or hit the back button on the app that I created, then selected/click player one, player two or player 3 button, depending on which kiosk they were in front of. Player one, player two or player three would then reach out to a hard coded google drive link inside the app that i would have uploaded a revision to (new mp4)

it seems the same issue would occur if moving from asd to shared storage, it would still move Player_Two.mp4 (2) and the activity starter would still be pointed to Player_Two.mp4, because local storage cannot rename/delete the existing file.

I’m not sure what you are talking about here…

You can delete programmatically files in ASD without limitation. And also in shared storage you can delete files. Precondition there is, that you own the file.

Taifun

Try this one: test_2.apk (4.4 MB)

Summary

1 Like

Thanks all
Traveling now for work but will definitely take a look at this tomorrow afternoon. Appreciate the help on this! Btw, im always pouring ovwr the forums to learn and for guidance. I was hoping Taifun and bodymindpower could pop in on answering. You two have helped me the most in reading other posts and your answers to them

Wow! Thats really cool. Just ran apk on phone and will try on android box tomorrow. I wont know until then but was avoiding using a media player because i thought it would be limited to the size of the phone screen. The actual mp4 presentation is 24.5" × 36" (62 cm x 81 cm) to be used on a 50" tv mounted in portrait mode. Again, i will have to try but it seems that a video player would be able to access asd and delete prior mp4 when new mp4 was updated versus the activity starter not being able to.

Once again, there are a whole series of serious bugs here:

  1. Videos cannot be played with the VideoPlayer component from the ASD with any possible path.
  2. The VideoPlayer component requests READ permissions even on Android 11+.
  3. The VideoPlayer component requests READ_MEDIA_AUDIO and not READ_MEDIA_VIDEO permission on Android 13+.

I really wonder what people are still doing here. Bugs everywhere you look

Thanks again for checking on this. I actually thought it was me that just was not getting-literally spending about a month on and off trying to make this work before reaching out to the community.

Perhaps they do it just like me: I am reading here How to do something, but it won’t work, and then I go to Nio…n and do it like that, and it will work. :smiley:

Would i be able to download the aia you used or the location of the simple download1 extension? I could not find it with kodular list of extensions or a basic google search. I did attempt these blocks with 2 different download extensions but cannot produce the same results as your apk upload. Thank you.

also tried the “join” after video player source. Downloads file but not as mp4 and of course does not play as mp4