private PendingResult<Snapshots.CommitSnapshotResult> writeSnapshot(Snapshot snapshot,
byte[] data, Bitmap coverImage, String desc) {
// Set the data payload for the snapshot
snapshot.getSnapshotContents().writeBytes(data);
// Create the change operation
SnapshotMetadataChange metadataChange = new SnapshotMetadataChange.Builder()
.setCoverImage(coverImage)
.setDescription(desc)
.build();
// Commit the operation
return Games.Snapshots.commitAndClose(mGoogleApiClient, snapshot, metadataChange);
}
https://developers.google.com/games/services/android/savedgames
The docs say that a reference to a Snapshot has to be obtained before calling writeSnaphot. Since snapshot is an interface it can't be created with new.
How to obtain a reference to a Snapshot?
Thank You!
P.S. I see that there is a way to obtain a reference by opening an existing saved game by name however the reference I would like to obtain is for a new Snapshot there are currently no existing snapshots so using the load function probably will not succeed in writing a new snapshot.