I’m happy to share the snapshot code from my test app. Again, it’s purely test code and my old code-pre-change once worked with the old plugin, so I can’t say this will work with the V1 plugin or not.
local myTable = { play = 1 } local snapshotFilename = "snapshot1" local data = json.encode( myTable ) local function gpgsSnapshotOpenForReadListener( event ) print( "snapshot open event:", json.prettify(event) ) if not event.isError then --local data = event.snapshot.contents.read() local data = gpgs.snapshots.getSnapshot (event.snapshotId) native.showAlert('Snapshots', 'Reading was ' .. (event.isError and 'unsuccessful' or 'successful') .. ',', { 'OK'}) end end local function gpgsSnapshotAfterSaveListener( event ) native.showAlert('Snapshots', 'Saving was ' .. (event.isError and 'unsuccessful' or 'successful') .. '.', {'OK'}) end local function openSnapshot() print("Opening snapshot") gpgs.snapshots.open({ filename = snapshotFilename, listener = gpgsSnapshotOpenForReadListener }) end local function gpgsSnapshotOpenForSaveListener( event ) print("open for save listener", json.prettify( event )) if not event.isError then local snapContent = gpgs.snapshots.getSnapshot(event.snapshotId).contents snapContent.write(data) -- Write new data as a JSON string into the snapshot gpgs.snapshots.save({ snapshotId = event.snapshotId, description = 'Save slot ' .. snapshotFilename, listener = gpgsSnapshotAfterSaveListener }) end end local function saveSnapshot() print("saving snapshhot") gpgs.snapshots.open({ -- Open the save slot filename = snapshotFilename, create = true, -- Create the snapshot if it's not found listener = gpgsSnapshotOpenForSaveListener }) end
There are still some issues we are working on with the testers so even if you managed to get access to the plugin when it was inadvertently made available, I still wouldn’t release against the V2 plugin until we say it’s ready.
Rob