I couldn't get to the original post from April 2023, so I started a new one...Sorryyyy...
In Android 13, I want to copy the file dbKnihy.sqlite from the folder...Documents/... to ASD.
It works for me via Companion...it creates dbBooks.sqlite with the tblBooks table.
But when I compile the .apk, it creates only dbKnihy.sqlite with the android_metadata table in the ASD folder on my mobile, the tblKnihy table is not there.
ASD path in mobile is: file:///storage/emulated/0/Android/data/_data_appinventor.ai_ondrejruz.Knihy/files/dbKnihy.sqlite
It doesn't work even when there is a relative path in gPathASD....
Where am I doing wrong?
Ondrej
Use Do It in companion to see what is happening
Do not hard code ASD file paths, use the ASD path finder blocks
You may have more luck using the file component and setting filescopes correctly.
This path is incorrect
How do you copy the file to ASD?
Taifun
Does it work?
It only works in Companion. So, in Companion, it just copies the file from the private directory on my mobile.../Documents/Zalohy/dbKnihy.sqlite to ASD and displays the contents of the file nicely. As soon as I make an .apk out of it, it doesn't copy correctly... and it's bad...
Ondrej
So this way I probably won't be able to copy the ...sqlite file from .../Documents to ASD...on mobile.
Are there any other options?
Ondrej
Here are the basics, tested compiled.
Filescope in Screen1 designer set to Legacy
I used an image, but your sqlite.db file should work in the same way.
Thanks for the example.
It works for me in Companion, but not on mobile.
Ondrej
Show us your blocks and explain how you found out, that it did not work to copy the file to ASD
Taifun
I send blocks. How do I send the dbKnihy.sqlite file?
Ondrej
[mod edit: please do not post aia projects containing paid extensions]
Test just one procedure at a time, your call to four procedures at once may be causing a conflict / failure.
You may need to delete the sqlite.db file in /Documents/Zalohy/ before your compile and try the app again. (Reason - not possible to work with files created by another app - e.g. companion app)
I save the dbKnihy.sqlite archive in the folder /Documents/Zalohy. So if I change the version of the .app, this new version will no longer "recognize" the file created by the previous version of the app?
If so, how is the file backup done?
Ondrej
No, in this case it is still the same app, only a new version
@TIMAI2 was talking about first testing using the companion app and storing the file and later trying to read that file after building the app, because theny ou are trying to read a file created by another app...
You forgot to answer this question
Also previously you used a wrong path... what about using the correct path?
Taifun
Hello. The app for copying the dbKnihy.sqlite file from /Documents/Backups/ to ASD does not work for me. That's why I created a test app with only a few blocks. In the input folder, dbKnihy has a size of 49,152. In the output folder after copies, it has only 12,000. Next, the app crashes with a Syntax error. quote in unquoted cell. In the output file, only the android_metadata table is copied... I am attaching blocks...
Can someone help?
Ondrej
You do not appear to have taken any of our advice above.....
Simplify your blocks, and just focus on the copying of the file from shared storage to the ASD.
Once you have that working, then you can start complicating things
Build in small steps, testing and checking at each step to ensure you have files in place and the correct file paths and permissions.
So the conclusion is probably that if I create e.g. in app1 the file dbKnihy.sqlite, so in another app, e.g. app2, I can no longer read that file and copy it to ASD in app2....
Is that so ?
Ondrej
Take us through the journey that your sqilte.db file goes through, step by step, from start to finish, then perhaps we can advise on the best course of action.
so in another app, e.g. app2, I can no longer read that file and copy it to ASD in app2....
Is that so ?
you still can read it using SAF
1.Introduction Description: Basically AI2 wrapper of Storage Access Framework. Using this extension, you can get read and/or write access to a single document or tree document (and all of its children recursively). Latest Version: 1.3 Released: 2021-09-16T18:30:00Z (UTC) Last Updated: 2023-11-15T18:30:00Z (UTC) 2.Blocks [image] [image] [image] [image] [image] [image] [image] [image] [image] 3.Documentation Events ErrorOccurred Event indicating error/excep…
Taifun