Deleting file is not working
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Deleting file is not working
Hello everyone!
As many times now, here i'm again having trouble deleting picture from folder on android...
I'm retrieveing the images from the same folder 'AKORIGINAL' i have created and view the pictures in datagridform. Also have succes to save the photos into another folder after getting the filename from datagridform row.
I have no success to implement to delete a picture from the same folder.
Explaining the situation to show that read and write permissions are ok, also the filename in tORIGINALFILENAME is working when retrieving from the above folder.
my code:
set the defaultFolder to "/storage/emulated/0/Documents/AKORIGINAL"
DELETE FILE "/storage/emulated/0/Documents/AKORIGINAL" & SLASH & tORIGINALFILENAME
delete URL("file:" & "/storage/emulated/0/Documents/AKORIGINAL" & SLASH & tORIGINALFILENAME)
The result is can't delete this file
Anyone can explain to me why is it?
As many times now, here i'm again having trouble deleting picture from folder on android...
I'm retrieveing the images from the same folder 'AKORIGINAL' i have created and view the pictures in datagridform. Also have succes to save the photos into another folder after getting the filename from datagridform row.
I have no success to implement to delete a picture from the same folder.
Explaining the situation to show that read and write permissions are ok, also the filename in tORIGINALFILENAME is working when retrieving from the above folder.
my code:
set the defaultFolder to "/storage/emulated/0/Documents/AKORIGINAL"
DELETE FILE "/storage/emulated/0/Documents/AKORIGINAL" & SLASH & tORIGINALFILENAME
delete URL("file:" & "/storage/emulated/0/Documents/AKORIGINAL" & SLASH & tORIGINALFILENAME)
The result is can't delete this file
Anyone can explain to me why is it?
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Deleting file is not working
You are trying to access the system document folder which isn't supported in LC yet. There are some restricted permissions there. Also, not all Android devices use that particular path so your code may fail on other devices.
I think we mentioned before that you should be using specialFolderPath("documents") instead, which is the private sandbox folder for your app. You have full control of that folder.
Also you don't need both versions of the delete command, but you probably knew that.
I think we mentioned before that you should be using specialFolderPath("documents") instead, which is the private sandbox folder for your app. You have full control of that folder.
Also you don't need both versions of the delete command, but you probably knew that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Deleting file is not working
No experiemce with android but my understanding is that at least at present on mobile (both iOS and Android) you can only modify files in the app’s sandboxed Documents folder on mobile - ie specialFolderPath(“Documents”).
As such i woukd imagine this code would not work as this action is probably not (yet?) supported…
At least thats my non-validated understanding…
As such i woukd imagine this code would not work as this action is probably not (yet?) supported…
At least thats my non-validated understanding…
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Deleting file is not working
And from what I know about the tightly controlled mobile phone environments, is unlikelyis probably not (yet?) supported…
to ever be supported.
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Deleting file is not working
I put in a feature request for it and the reply was that it was a good idea. Other apps have access, so with the correct setup I think LC could too. On the other hand, Android refuses access except when specifically requested by the user (i.e., some kind of dialog..) So we'll see.richmond62 wrote: ↑Sat Jul 23, 2022 7:38 pmAnd from what I know about the tightly controlled mobile phone environments, is unlikelyis probably not (yet?) supported…
to ever be supported.
I should also have mentioned that in my old Android 8 tablet, there is no system Documents folder at all, which means the OP's code may or will fail on older devices. I'm not sure if it exists on newer devices or whether some other app created a Documents folder on my Android 12 phone.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Deleting file is not working
On iOS, apps can access the icloud drive, like a non-application specific documents folder. So there is an API to do something like this, but not yet through LiveCode. I have no experience of Android but perhaps there is something similar. I hope that in the future this will be possible…
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Deleting file is not working
In the olden days Apple used to provide WebDAV access to user cloud services. Not sure if that's still available. Microsoft's OneCloud, AWS, Google Drive, Nextcloud, Box, DropBox, PCloud, and most others do.stam wrote: ↑Sat Jul 23, 2022 8:50 pmOn iOS, apps can access the icloud drive, like a non-application specific documents folder. So there is an API to do something like this, but not yet through LiveCode. I have no experience of Android but perhaps there is something similar. I hope that in the future this will be possible…
There are some nice libraries for using WebDAV in LiveCode:
https://forums.livecode.com/viewtopic.p ... 77#p188099
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Deleting file is not working
If I remember right, the OP only needs local app access so the sandboxed documents folder should work fine.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Deleting file is not working
Hi!
Thanks for everyone for their help.
Can i just clear what Jacques posted?
In system/documenrs folder i've created folder A and folder B let say.
So i have a third party camera app saves plctures into the folder in system/documents/A folder. From the same folder a dgform is polulated and from there user select a picture and save it to another folder in system/documents/B folder. So as far i see i can read and write to this created by me folders but delete needs another permission?
From folder A i want to delete the pictire.
And yes Jacqe, you have recommended to use specialfolderpath(documents) and i know the addvatages of it. The reason is i want to have some other solution is, because i'm not able to get mobilepickphoto camera running on android 12 stabilly. It works as it thinks, i have mentioned those in my other posts. Anything i have tried did not work. Sometimes after hit ok in camera app it does nothing just quit. Sometimes camera app does not open at all etc. So because all of the above, i save pictures into system folder documents A with a third party camera app, and from there i save it into my remote mysql db and into another system documents folder B.
But from the third party camera app that i use can not access the specialfolder document folder can i?
And lastly i use the same code on 4 tablet with android 12 on them, all the same. Plus 1 with android 11. File systems of them are the same.
Thanks again for all of you
Ps. Jacque if you might have anything for me will be appriciated
Using Livecode commmunity 9.6.3
Thanks for everyone for their help.
Can i just clear what Jacques posted?
In system/documenrs folder i've created folder A and folder B let say.
So i have a third party camera app saves plctures into the folder in system/documents/A folder. From the same folder a dgform is polulated and from there user select a picture and save it to another folder in system/documents/B folder. So as far i see i can read and write to this created by me folders but delete needs another permission?
From folder A i want to delete the pictire.
And yes Jacqe, you have recommended to use specialfolderpath(documents) and i know the addvatages of it. The reason is i want to have some other solution is, because i'm not able to get mobilepickphoto camera running on android 12 stabilly. It works as it thinks, i have mentioned those in my other posts. Anything i have tried did not work. Sometimes after hit ok in camera app it does nothing just quit. Sometimes camera app does not open at all etc. So because all of the above, i save pictures into system folder documents A with a third party camera app, and from there i save it into my remote mysql db and into another system documents folder B.
But from the third party camera app that i use can not access the specialfolder document folder can i?
And lastly i use the same code on 4 tablet with android 12 on them, all the same. Plus 1 with android 11. File systems of them are the same.
Thanks again for all of you
Ps. Jacque if you might have anything for me will be appriciated
Using Livecode commmunity 9.6.3
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Deleting file is not working
I understand now. Android only allows file deletion from the system folders if the user deletes it using a file manager, or by the app that created it. This is a security measure. In your case, a third party app created the file so only that app can delete it.
The actual problem is that the camera functions are not working for you. If it did, you would not need the third-party app. There might be a problem with the community edition of LC, there have been many bug fixes since then.
You could see if the camera app allows you to send a delete instruction to it. If so, that app should be able to remove the file. Or see if you can tell the app to send you the image instead of saving it to disk.
The actual problem is that the camera functions are not working for you. If it did, you would not need the third-party app. There might be a problem with the community edition of LC, there have been many bug fixes since then.
You could see if the camera app allows you to send a delete instruction to it. If so, that app should be able to remove the file. Or see if you can tell the app to send you the image instead of saving it to disk.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Deleting file is not working
Thanks Jacque!
My original app uses mobilepickphoto to launch the camera, save pics and thumbnails etc. But unfortunately was not stable. So finally stick with the third party camera app with the mentioned inconviniences.
During my researces about mobilepickphoto it seemed that Panos has taken care of this in the LC 9.6 release. So i have tried to build my standalone with api 26 to 29, each time tested on different devices from android 7-12, neither of them works.
Wondering: is it possible to see somewhere what the code is of mobilepickphoto?
Thank you
My original app uses mobilepickphoto to launch the camera, save pics and thumbnails etc. But unfortunately was not stable. So finally stick with the third party camera app with the mentioned inconviniences.
During my researces about mobilepickphoto it seemed that Panos has taken care of this in the LC 9.6 release. So i have tried to build my standalone with api 26 to 29, each time tested on different devices from android 7-12, neither of them works.
Wondering: is it possible to see somewhere what the code is of mobilepickphoto?
Thank you
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Deleting file is not working
What version is the community edition? Is that 9.6? I have a commercial license so I haven't paid attention to the free one. I've never needed mobilePickPhoto so I don't have any script handy. Maybe someone else does.
Do you have a link to the bug report?
Do you have a link to the bug report?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Deleting file is not working
Thanks Jacque!
I do not have the link, but surely i have read it with the name of Panos. It said that the mobilepickphoto camera and library has been fixed at LC 9.6 with api 29. There was written to check permissions like camera access and read-write to external files, he also fixed it in code he has provided regarding to permission issues.
The number u bug was 25.. something if i recall it well.
I have found two of them.
Please see this:
" ================
LiveCode 9.6.2 STABLE comes with 49 changes since the last stable release (9.6.1), including:
New Features
- Support for the newly released MacOS Big Sur
- Support for building with Xcode 12.1, using the iOS 14.1 SDK
- New tsNet and mergExt builds, built with the iOS 14.1 SDK
Bug Fixes:
- Fixed crash with mobilePickPhoto on Android 11
- Fixed 'revIsSpeaking()' function on Windows
- Faster deployment to iOS simulator
- Several fixes related to modal dialogs on MacOS
- Several dictionary fixes and documentation improvements"
And also
Updates in the LiveCode open source project
35 pull requests were merged since the last issue.
New LiveCode releases
LiveCode 9.0.4 RC-2
Notable changes
ByteOffset: Fixed bug causing incorrect results
Fix crash when using inf in math ops
Fix encoding of svg paths containing relative commands
Fix Android openGL compositor surface height issue
Ensure mobilePickPhoto works in all Android devices
Fix video view closing when player control is grouped / ungrouped
Dozens of fixes to memory leaks
I do not have the link, but surely i have read it with the name of Panos. It said that the mobilepickphoto camera and library has been fixed at LC 9.6 with api 29. There was written to check permissions like camera access and read-write to external files, he also fixed it in code he has provided regarding to permission issues.
The number u bug was 25.. something if i recall it well.
I have found two of them.
Please see this:
" ================
LiveCode 9.6.2 STABLE comes with 49 changes since the last stable release (9.6.1), including:
New Features
- Support for the newly released MacOS Big Sur
- Support for building with Xcode 12.1, using the iOS 14.1 SDK
- New tsNet and mergExt builds, built with the iOS 14.1 SDK
Bug Fixes:
- Fixed crash with mobilePickPhoto on Android 11
- Fixed 'revIsSpeaking()' function on Windows
- Faster deployment to iOS simulator
- Several fixes related to modal dialogs on MacOS
- Several dictionary fixes and documentation improvements"
And also
Updates in the LiveCode open source project
35 pull requests were merged since the last issue.
New LiveCode releases
LiveCode 9.0.4 RC-2
Notable changes
ByteOffset: Fixed bug causing incorrect results
Fix crash when using inf in math ops
Fix encoding of svg paths containing relative commands
Fix Android openGL compositor surface height issue
Ensure mobilePickPhoto works in all Android devices
Fix video view closing when player control is grouped / ungrouped
Dozens of fixes to memory leaks
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Deleting file is not working
Sorry for the delay, I just noticed I didn't respond here yet. What version is the community edition? It may be too old for the fixes that came later. API 29 means that the LC IDE can build for that Android OS but it does not mean that setting the build target to API to 29 will fix the bug.
Android now requires apps to be built with API 30 and that will change to 31 soon, so it may be that the community edition of LC is too old. I think the update to support API 29 was a couple of years ago.
Android now requires apps to be built with API 30 and that will change to 31 soon, so it may be that the community edition of LC is too old. I think the update to support API 29 was a couple of years ago.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Deleting file is not working
The last open source version of LiveCode is 9.6.3.