Hi. For general workflow you can follow official docs and examples by Google. Like this
https://developers.google.com/games/services/android/savedgames
Or this
https://www.youtube.com/watch?v=iHc2RBZs5T0
First, you need to open/create a snapshot. Use gpgs.snapshots.open()
gpgs.snapshots.open({ filename = filename, create = true, listener = function(event) print('Open event:', json.prettify(event)) snapshotId = event.snapshotId end })
filename is any string, for example “save_slot_1”.
Save snapshotId for later use.
Then you need to get the actual snapshot object, with which you can interact.
local snapshot = gpgs.snapshots.getSnapshot(snapshotId)
Now you can write some data or read some data, depending on what you want - save or load.
-- Save snapshot.contents.write('New data inside the snapshot, this can be a JSON string') -- Load print(snapshot.contents.read()) -- returns previously saved data, if it's a JSON, you can decode it into a table.
After you modified data, you must tell the plugin to upload the snapshot to the Google’s server.
gpgs.snapshots.save({ snapshotId = snapshot.id, description = 'Save Slot ' .. snapshot.id, playedTime = '12151', progress = 150, image = {filename = 'images/snapshot.png'}, listener = function(event) print('Save event:', json.prettify(event)) end })
Here only snapshotId param is required, else is optional.
From that point the player can pick up another device, load that snapshot and retrieve the saved data.
I hope that helps. If you have any other questions - feel free to ask.