Probably a stupid question, but what do I have to change to make this code work:
package com.hobogames.WizardsDuel;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;
public class GameData {
public static String version = "1.0.0";
public static String data[] = {"version"};
public static final int VERSION = 0;
public static Preferences prefs = Gdx.app.getPreferences("WizWars");
public static boolean played = (!prefs.get().isEmpty());
public static String getString(int key){
return prefs.getString(data[key]);
}
public static void storePrefs(){
prefs.putString(getString(VERSION),version);
prefs.flush();
}
}
The part in particular that isn't working is that "played" is false every time on an android device. On desktop it's true after the first play.