RenPy Android Save Games

Deleted member 331233

Well-Known Member
Game Developer
Dec 14, 2017
1,321
7,326
Hello there,

I'm porting my game to android and all seems to work well but one issue, if you uninstall the APK and install a new version or reinstall the old, all your saves disappear. Is there a way to set a static save point so they will stay no matter what?
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,566
7,382
Unfortunately, by default, this is the way that Android works - when you uninstall an Android program, it removes all the data associated with that program.

On the Ren'py forums, it's been said that the saves are stored in on the SD card in SD:/Android/data/com.{gamename}.program/files/saves/. Thus, in theory, one could grab them before updating/reinstalling and manually restore them. There are "File Manager" tools available for Android that will allow this.
 

Deleted member 331233

Well-Known Member
Game Developer
Dec 14, 2017
1,321
7,326
Unfortunately, by default, this is the way that Android works - when you uninstall an Android program, it removes all the data associated with that program.

On the Ren'py forums, it's been said that the saves are stored in on the SD card in SD:/Android/data/com.{gamename}.program/files/saves/. Thus, in theory, one could grab them before updating/reinstalling and manually restore them. There are "File Manager" tools available for Android that will allow this.
Ah.. I figured as much with the default settings of android.

I've seen some porters somehow make it to where your saves are saved permanently so I might have to contact them directly and see how they managed it I suppose.

Thanks for the response!
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,566
7,382
Ah.. I figured as much with the default settings of android.

I've seen some porters somehow make it to where your saves are saved permanently so I might have to contact them directly and see how they managed it I suppose.

Thanks for the response!
Since the Ren'py source is available on GitHub, it's probably straightforward to figure out how Ren'py figures out where to put the saves in Android. It's possible that there's a constant over in the Python that you could hack to change the directory so that it's not one that Android associates with your application.
 

CeLezte

Member
Sep 10, 2017
234
147
Not all Android devices support SD cards (see Google's Nexus and Pixel series).
As it was stated above Preferences and Local Databases of your Apps are deleted when the user decides to uninstall your App.

Most (NOT ALL) devices let you write data into their /data/local/tmp folder. So this could be a place where you could try and save your data. Although it is not guaranteed that the data will stay there forever.

I would recommend writing a backend server where your users can save their games either through registering an account or other means. The Android SDK is has very good Firebase/Firestore Support in case you decide to store game save backups online. If you don't trust Google with your data you can roll on your own and lookup Python and Django with some data base coding (Mongoose, MySQL).
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,975
16,230
I would recommend writing a backend server where your users can save their games either through registering an account or other means.
I don't know shit about Android, but was curious and did some search on the subject. Which lead to my question : Isn't this automatic since Android 6.0 (at least unless you explicitly disabled auto-backup) ?


 

CeLezte

Member
Sep 10, 2017
234
147
I don't know shit about Android, but was curious and did some search on the subject. Which lead to my question : Isn't this automatic since Android 6.0 (at least unless you explicitly disabled auto-backup) ?


You can't expect all your users to be on Marshmallow and above. That's the real charm of Android :-/

Another thing about backups is that you'll need tell your user to interact with the backup and restore dialogs and to get your save files. If you are fine with that and know how to handle it in a non-invasive way, then you are good to go.
 
  • Like
Reactions: anne O'nymous

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,975
16,230
You can't expect all your users to be on Marshmallow and above. That's the real charm of Android :-/
Well, I'm not even near to release the first version of my game, and I already know that I'll not provide an Android version :D
 

lewdgamerxxx

Active Member
Compressor
Sep 6, 2018
725
2,132
Ah.. I figured as much with the default settings of android.

I've seen some porters somehow make it to where your saves are saved permanently so I might have to contact them directly and see how they managed it I suppose.

Thanks for the response!
Did You Find OUT??
 

Chrikopher

Newbie
Jun 12, 2020
30
30
I've searched a bit yet I can't find a response to my question so I thought I'd bring my question here.

Where do I find game save files for Ren'py if I don't use an SD Card? Is there even a way?
 

Tompte

Member
Dec 22, 2017
216
157
Where do I find game save files for Ren'py if I don't use an SD Card? Is there even a way?
My understanding is that the SD-card api is named that way for historical reasons and that it will save to an SD-card or whatever storage is available. I could be wrong but I always took it to mean that it saves into some local storage that isn't in the cloud and is a well-known location (i.e. not an arbitrary location like on a PC).

With Android it will always depend on the type of phone and the manufacturer so I can't say for sure. The Android games I've worked on had cloud saves via google play and the sd card storage was more or less the fallback. More experienced Android developers can correct me.

I would try using the sd card functions renpy provides on a device and see what happens. Do the saves really disappear on uninstall? I wouldn't get too hung up on the name since Android isn't exactly famous for being good to programmers.

Edit:
I had a look around the Android SDK documentation and I seem to be correct that "sd card" is just a shorthand for any "external storage" (renpy simply repeats Android's naming convension), unlike "internal storage" which is directly associated with the APK. It also seems to hint that it doesn't necessarily needs to be a physical card but can be built-in as well, which I assumed. ("Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer. ")
 
Last edited: