Taifun File Extension

546 views
Skip to first unread message

Timothy Fox

unread,
Nov 28, 2016, 5:29:04 PM11/28/16
to MIT App Inventor Forum
Ive been working with Taifuns file extension and got most everything working. 
I have a app that records audio and video. You are able to export both and save both in a tinydb for recall. 

in order to export video I used the get content uri from the extenstion.  That will display the correct path to the video.

I would like to delete the video when the tinydb entry is deleted.  Im using the delete filename extension, and using the label Path.text  (this block holds the content uri path from the load and playback)
but it doesnt delete the file.

Any ideas?

Taifun

unread,
Nov 28, 2016, 6:12:41 PM11/28/16
to MIT App Inventor Forum
use the complete filename of the video to delete it (and not the content uri)

It would really help if you provided a screenshot of your relevant blocks including Do it results, so we can see what you are trying to do, and where the problem may be.

Taifun

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


Timothy Fox

unread,
Nov 28, 2016, 7:08:23 PM11/28/16
to mitappinv...@googlegroups.com

Here are the blocks showing whats going on..  As you can see the content uri will 'find' the clips location on the device and display the whole path plus file name.

In the list files block you see that it lists all the files in that directory, which is the same as the content uri displays.

Is there a work around for putting the filename in the block?   I need to be able to delete the file associated with that entry/uri where ever it is on the device.
Ive tried putting the filename and path with filename hard coded into the blocks and it says it cant find the file. Just like the uri path.

Ive tried just the filename, and tried join path with filename.  neither 'locate' the file. Ive verified the file name is correct.

Ive tried on a few different devices and the path is a little different depending on the phone, but it lists the correct path every time.  I just need to be able to delete the file when I delete the associated record in the tiny db.  (the delete code is in the notify block and is very lengthy, but its a standard delete the entry and clear tag)    The above code is just for testing.  Once i get it working Ill move it to where it needs to be. Now The code shows the path, with all the files, correctly. but the delete isnt working saying file not found.


This is version 2... Ive tried to chop up the file path to just display the filename only and link that to the delete, with no luck.  And now it has the hard coded path and file name, does nothing.. no error nothing. The file still is located in the directory after delete.

Taifun

unread,
Nov 29, 2016, 9:45:08 AM11/29/16
to MIT App Inventor Forum
your version 2 looks fine
you are trying to delete a file from an external sdcard

unfortunately I do not have such device, so I can't test this
I now set the feature "deleting a file from the external sdcard" to experimental
there might be the similar restrictions as for copying files, see the notes below the copy method here https://puravidaapps.com/file.php

Taifun 

Timothy Fox

unread,
Nov 29, 2016, 11:29:46 AM11/29/16
to MIT App Inventor Forum
It may look ok, but it doesnt work.  Ive tried it on a device with a sd card and one without.

  I can show the path and filename with the uri in a label and use that label to display the correct path, but it doesnt delete the file, no error, no message....

I put the the code to a file on the device and it deleted no problem. 

Using ES File explorer, I tried to rename a file on the SD (to make it easier to find) and it threw a message that my device did not allow ES to to make edits to the SD card unless the device is rooted. HOWEVER, I was able to rename that same file using the file manager that came on the device.  

Does your extension need permissions to delete from the SD?

Taifun

unread,
Nov 29, 2016, 1:07:36 PM11/29/16
to MIT App Inventor Forum
I found this post http://android.stackexchange.com/a/96604 

but unfortunately I will not be able to follow that recommendation, because (as already said) I do not have a device witch has an external sdcard, so I'm not able to implement this...

Taifun

Timothy Fox

unread,
Nov 29, 2016, 9:59:45 PM11/29/16
to MIT App Inventor Forum
I think there must be a bug when it comes to the external SD card.  Ive tried every way under the sun to delete a file. starting with File:///mnt/extSdCard/DCIM/Camera/filename.mp4 and going down to filename.mp4.

I can delete just fine from the device.  I think it may be something in the OS.  ES File Explorer and another file manager is 'not allowed' to make edits to the sd, but the preloaded file manager can delete, rename anything on the SD.

Does anyone know a work around?  Ive tried activity starters, file, taifuns file extension, everything.

Just reading through posts I know there are a bunch of people who have the same issue.

Taifun

unread,
Nov 30, 2016, 7:54:10 AM11/30/16
to MIT App Inventor Forum
read again the links in my previous answer 
use the internal sdcard instead
Taifun
Reply all
Reply to author
Forward
0 new messages