Hello, I test my game on the network, I can close my browser and open it back, and the score is saved. But, when playing in the apk, close the app and opening it back doesn’t save anything…!
Second Scene(Load & Write):
Yeah so it doesn’t save on the app, only in browser testing and windows testing. Any help would be great… OF COURSE It has to work everywhere except where I need it to!!! Tried with and without “close structured data”. I saw many posts, none fixed my problem, it saves everywhere except in an APK. I’m having the same problem with all my mobile games, can’t save!
hello try following this tutorial you should realise the issue
Did you managed to get this solved?
I have never experienced this personally but I did see complains from people on Cordova forums regarding reading and writing local storage does not work on Android.
It seems the problem is that in most cases the app was loading slow and if you try to read and write storage at the very beginning the app may be just did not get the required permissions yet and reading and writing the storage is fail at the beginning.
In most cases the solution was to wat for the device to be done loading the app before reading and writing the storage but GDevelop does not provide such condition to listen to such event and in theory it should run the At the beginning condition when the game finished loading? Not entirely sure what is happening there to be honest.
What you can maybe try is use a timer. Fire a timer at the beginning and read and write after a second maybe or use a button just to see if you wait longer does it help.
The second common problem is seems to be that Android also clear storage of apps if running low on system storage.
In case the problem is that the phone is running out of system storage and Android clear the storage of your game, the only thing you can try is maybe delete some apps and see if it helps.
As I mentioned I have never experienced this myself, but it seems this problem is do exists with Cordova and Android which I find interesting how could you possibly solve this with GDevelop.
It may require a new condition maybe to check if the device is ready or something to make sure you can read and write local storage.
Sadly I have 0 idea of how I solved it, I remember changing barely anything and tried exporting it and it worked… so I’m always scared to touch anything close to the save code now since I have no idea what it was.
Wondering if it was really something you have changed in the save events. Maybe it was something else that caused the game to load slowly. Did you delete any big images or many images or audio files, fonts by any chance or maybe some unrelated actions that was also run At the beginning or removed a behavior from an object or deleted an extension?
Only been adding more stuff really + I don’t use any extensions. Hope I figure it out so I can tell u.
But you might be right.
Oh and to answer this, my phone has 120GB and most of it is empty. Tried on multiple devices when it wouldn’t save. Now that it saves it saves on all devices