Wednesday 2 December 2020

Creating a byte array from an SqliteDatabase to save it with Google Saved Games?

I have a game where I use a couple of tables to store player's progress. It is quite long game so from time to time I'm having this legitimate user feedback about why I don't have cloud save option?

Therefore I do use Google Play Games sign in to have achievements, I thought I could simply implement Google Saved Games as well, straightforward.

As I see, it uses a simple byte[] array to save & load game progression from the cloud. (Google Drive, actually.)

My question is, how can I create a byte[] array which holds the FULL database of a player's saved game instance?

I'm using Sqlite Database like:

private static DatabaseHelper mInstance = null;


private DatabaseHelper(Context context) {
    super(context, "duels_rpg_db", null, 123);
  

    this.ctx = context;

 
    getWritableDatabase();
}


public static DatabaseHelper getInstance(Context ctx) {

   
    if (mInstance == null) {
        mInstance = new DatabaseHelper(ctx.getApplicationContext());
    }
    return mInstance;
}

and so on, nothing extraordinary.

Thanks in advance,



from Creating a byte array from an SqliteDatabase to save it with Google Saved Games?

No comments:

Post a Comment