Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | alexzheng | |
Old Version | Published before Godot 3 was released. |
I have a txt file in the project directory, and I can read it from the path res://myfile
But when I run on an Android device, it check it with file_exists, it return false, am I miss some permissions?
Also, I can not read or write to file in user:// on Android.
But it has no problem when run on iOS device.
alexzheng | 2017-09-08 14:48
On Android, when the app exit by press back
_exit_tree will not called, but I can do save work in _notification by the notification NOTIFICATION_WM_QUIT_REQUEST.
But the app was force exit, No NOTIFICATION_WM_QUIT_REQUEST is received, and no way to save data.
It’s very confusing.
alexzheng | 2017-09-08 15:54
Maybe I must save to disk for each change, but this is not good way,
alexzheng | 2017-09-08 15:56
No that is to be expected. Force close is a kill.
So IMHO always save your settings if there’s a change wich is worth saving. (level completed, option saved etc.)
I do even rename the previous settings file as a backup (only once per startup) in case that the save-process gets interrupted by a force-close or other event (disk space full). Naturally I then also have to check for integrity when loading the settings on restart and switch to the backup settings file when encountering problems.
wombatstampede | 2017-09-11 09:45