Can SharedObject on Android just disappear?

I’ve got a couple of bug reports for my game. People say that they completely loose the progress and the settings have reverted to default. This means that the data in the Shared Object have vanished.

Has anyone encountered behavior like this? The data I save is quite big, let’s say, Array filled with Number, of length 1000.

What is the better strategy to have a save of AIR game? I heard of writing ByteArray to file?

1 Like

My game is also often feedback data loss, this problem can not find the reason.

Are you using Shared Object as well?

Yes, the SharedObject data was lost when I exited the game and entered again

I’ve used SQLConnection for storing data locally. It’s great for reading/filtering/parsing the users data as you can execute sql commands on it.
https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/data/SQLConnection.html

SharedObject sounds like it would be more useful for sharing data.

Why chose just one way though? Go ahead and add redundancy so that if one method fails, the game data can possibly be recovered from the other method.

2 Likes

Might that be related with memory flush utilities?
I am not sure where SharedObject data is stored, but it might be treated similarly to browser cookies and get deleted with a cache lceaner?

On iOS there are some folders where to write data that get backed up on the cloud and restored on other machines, this would be the perfect place to save game progress.

I know the temptation of leveraging the simplicity of SharedObject is high :slight_smile:

1 Like

I also use the Shared Object for save data and have noticed times where the data appears to be lost or modified. For my cases where this happened, I tracked it down to the built in cloud data restore feature of Android. Google Play periodically and without ability for the user to control, will take a snap-shot of the data associated with an app. So, when I’m developing and testing (ex: replacing the app with newer version) typically the data is wiped for the new install, but then will re-appear with the cloud-imprinted save data at some later point in time. I have not experienced this affecting an end-user.

Per my findings, SharedObject data gets stored on Android in the Application Storage, not the Cache (which I tested by using the Clear storage / Clear cache options in the application Storage menu accessed by tapping and holding on the app). For my game, I explicitly use the cacheStorage for graphics files that are rasterized by the app at runtime by setting the file path with File.cacheDirectory.

I know that Apple, for instance, has some strict requirements around the types of files that get stored in applicationStorage vs. the cacheStorage (so as not to have all recoverable items like DLC being backed up on the cloud) and I suspect there are detection mechanisms in place on both Android/iOS to ensure files marked for cloud save are not too large. Based on your description, I doubt your SharedObject file is exceeding the limit, but perhaps if you are storing other files in the ApplicationStorage instead of the cache folder, it could be triggering such a mechanism and forcing the app to clear its data when file space is required by the OS.

I wanted to suggest this since it would have the same effect of wiping saves even if you switched to writing to a ByteArray file. Thanks for sharing this and please keep us updated on your findings/solutions.

3 Likes

Thank you! Yes, I’m now completing a big content update for the game, after it I’ll continue work on save durability

1 Like