Closed yohannes-jo closed 1 year ago
Hello @yohannes-jo
Android stops any applications from modifying the content of the program folder directly.
There's basically two cases:
READ-ONLY DATABASE: In this case you can just leave the database in the application folder, but you have to open the database in rad-only mode.
READ-WRITE DATABASE: In this case you have to copy the database to the user://-folder as Android does not permit the user to overwrite files in the application folder. See the demo/-project included in this repository to see how to do it: https://github.com/2shady4u/godot-sqlite/blob/master/demo/database.gd
Thank you so much, bless you. It worked. I just didn't know how to copy a file inside of code before so thank you.
No problem @yohannes-jo ! 😄
Environment:
Issue description: Database doesn't work on android. I checked the docs and it says to copy db files manually to user:// but that doesn't seem natural if I have to add another step for installing game. Did you mean to say copy it manually like copy-paste to org.godotengine.gamename folder in android/data or do that in code? if the latter one is true, how does one do that? (gdscript)
The plugin works perfectly well on desktop, just not on android.
Steps to reproduce: new project, install plugin make a new sqlite database, verify that the plugin works perfectly on desktop by doing basic CRUD, do the same thing but export for android (see whether it works).
Minimal reproduction project:
const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns") var db var db_name = "user://question_database" var session_db_name = "user://session_log_database"
This is how I labelled the databases and they work fine as res:// on desktop, but even if I change to user:// it won't work.Additional context None