Where and how are files stored on android?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Anmevel

hello, I have a question, how do I save a .jonson file when exporting to android, since in pc it would be like “res: // inventor // items” in android “storage // emulated // 0 //”? I already tried and it did not work :C

:bust_in_silhouette: Reply From: eons

You should always use user://, that place is where the operating system lets the application to save its (user) data and do not require any extra permission.

Otherwise, on some systems the app will need administrator privileges or special permissions to be able to access to different storage units/paths.

I have it like this:

var url_database_item = “user://SameSpace//Database_Items.json”

on the pc I get this error:

Invalid call. Nonexistent function ‘has’ in base ‘Nil’.

With what name should I put so that in android and in pc it is allowed to open?

Anmevel | 2018-07-28 07:08

user://SameSpace/Database_Items.json (single /) shoud work, check if you are reading and saving it with the same name (respecting uppercase), you can search for your game’s data directory to check if the file is there.
It may be on Users\<your_user>\AppData\Roaming\<game_name>.

eons | 2018-07-28 23:53

Can I use res:// instead of user:// for files that won’t change?
For example, I want to save a file that contains dialogs in this way.

Ivan643 | 2021-06-04 23:17