3

I'm building a game with Libgdx, and while implementing the save game using Libgdx preferences, I thought I'd ask if this will also work with iOS (using RoboVM). If not I will have to use another way to save game.

I would test it myself, but I do not currently have any iOS device. So, sorry for that :)

Here's my (simple) save code:

    public void saveGame()
    {
        Json json = new Json();
        String result = json.toJson(this.playerCharacter);
        Preferences prefs = Gdx.app.getPreferences("Shared");
        prefs.putString("SaveGame", result);
        prefs.flush();
    }
Charbel
  • 658
  • 5
  • 13

1 Answers1

6

Preferences should work. Several of the libgdx demo games use Preferences and work fine with the RoboVM iOS backend.

ntherning
  • 1,160
  • 7
  • 8