Help about how delete files from the app

Hello guys, I need some suggestions about where save files that my app may delete. Actually I download a sqlite 3 DB in ASD but the app needs to update the DB sometimes, several times, so the app should be able to delete the DB before downloading the new DB. Downloading a set of SQL queries to update the DB is not a solution because I have to save and then to delete them.

Use File1.Delete block

I tried it but it does not delete the file, I know that in assets directory I can not delete files but I supposed in ASD I can, I am testin on Android 13 device. It works only using companion, not using the apk. So, I may be wrong but seems that also in ASD I can not delete files, do you know directories where can I download/save and delete files? I read a document about storage rules in Android, seems I am respecting them but I am not able to delete my db anyway.

You can delete files in the ASD, it is your application directory, you have read/write to the ASD from within your app.

Show your relevant delete blocks (and filescopes)

OK, so there is something not working, this is a good information. I kindly prefer if it is an error of mine.

Use delete file block from ASD Downloader extension.

No extension needed, just use the File component (no need to call for any permissions either)

1 Like

Yes, but no "//" is needed in front of the fileName.

Are you sure your current app has the same packageName?

OK, seems I have 2 problems:

  1. using AI2 online I am able to delete the files in ASD without asking any permission. I am using the DonwnloadToASD extension made by Anke and everything works properly botn using Companion and the apk.
  2. Using AI2Offline it works only with its Companion, the apk asks for Internet permission and if I add the block to ask it, the permission is denied always.
  3. If I load my aia to AI2 online it reads not so well the blocks in Screen1 so I can not build the apk with it. The apk build by AI2Offline gives error when the app tries to delete files from ASD and the asset, simply appears a notifier sayin that is not possible to delete files from ASD and another one notifier for delete a file from assets.
  4. Loading the aia in AI2 online returns this error: The blocks area did not load properly. Changes to the blocks for screen 5774672896327680_Screen1 will not be saved. Instead the same aia is still read well by AI2Offline.

Did you set the correct packageName in AI2Offline? Why are you switching between online and offline version?

  1. When I create a new project I left the choice on Default package. How can I check if I set the correct packageName in AI2Offline?
  2. Mainly for 2 reasons: in the past and also recently I experienced a lot of problems probably due to the internet bandwidth and to have a way to backup the app(s) together what I used to develop them.

So the packageName has to be

Ahhhhh... ok, I understood a different thing. Those are OK and in any case at the moment this app will not be published on Google store. Because now, in the most recent versions of AI2Offline when you start a new project it asks the app package to use as in the attached picture.

yesss, that's ok, thanks for the clarification.

As suggested by Ramiro Prieto Alvarez, the maintainer of AI2Offline, I checked the Internet Permission box on the properties of Screen1 in the designer view Advanced section solves the problem of the test app that now writes and delete files in the ASD without any other permission. My original app still has problems because says that it can not delete a file from the assets but I need to check if this is my error, I hope it is my error so I can fix it.

The problem is that I am not deleting files form the asset folder, at least intentionally, so I hope to put an error on my design.