Play Games Services Snapshots

Native API for Play Games Services Snapshots.

Summary

Enumerations

PgsSnapshotConflictPolicy enum

Typedefs

PgsSnapshot typedef
struct PgsSnapshot
An opaque handle to a Snapshot.
PgsSnapshotConflict typedef
An opaque handle to a Snapshot Conflict.
PgsSnapshotContents typedef
An opaque handle to Snapshot Contents.
PgsSnapshotsClient_CommitAndCloseCallback)(PgsStatusCode status_code, PgsSnapshotMetadata *metadata, void *user_data) typedef
void(*
Callback for PgsSnapshotsClient_commitAndClose.
PgsSnapshotsClient_DeleteCallback)(PgsStatusCode status_code, const char *snapshot_id, void *user_data) typedef
void(*
Callback for PgsSnapshotsClient_delete.
PgsSnapshotsClient_DiscardAndCloseCallback)(PgsStatusCode status_code, void *user_data) typedef
void(*
Callback for PgsSnapshotsClient_discardAndClose.
PgsSnapshotsClient_GetMaxCoverImageSizeCallback)(PgsStatusCode status_code, int32_t max_size, void *user_data) typedef
void(*
Callback for PgsSnapshotsClient_getMaxCoverImageSize.
PgsSnapshotsClient_GetMaxDataSizeCallback)(PgsStatusCode status_code, int32_t max_size, void *user_data) typedef
void(*
Callback for PgsSnapshotsClient_getMaxDataSize.
PgsSnapshotsClient_LoadCallback)(PgsStatusCode status_code, PgsSnapshotMetadata *snapshots_array, size_t snapshots_count, void *user_data) typedef
void(*
Callback for PgsSnapshotsClient_load.
PgsSnapshotsClient_OpenCallback)(PgsStatusCode status_code, PgsSnapshot *snapshot, PgsSnapshotConflict *conflict, void *user_data) typedef
void(*
Callback for PgsSnapshotsClient_open and PgsSnapshotsClient_resolveConflict.
PgsSnapshotsClient_ShowSelectSnapshotUICallback)(PgsStatusCode status_code, void *user_data) typedef
void(*
Callback for PgsSnapshotsClient_showSelectSnapshotUI.

Functions

PgsSnapshotConflict_destroy(PgsSnapshotConflict *conflict)
void
Destroys a PgsSnapshotConflict instance.
PgsSnapshotContents_destroy(PgsSnapshotContents *contents)
void
Destroys a PgsSnapshotContents instance.
PgsSnapshot_destroy(PgsSnapshot *snapshot)
void
Destroys a PgsSnapshot instance.
PgsSnapshotsClient_commitAndClose(PgsSnapshotsClient *snapshots_client, PgsSnapshot *snapshot, PgsSnapshotMetadataChange *metadata_change, const uint8_t *data, size_t data_size, PgsSnapshotsClient_CommitAndCloseCallback callback, void *user_data)
void
Asynchronously commits and closes a snapshot.
PgsSnapshotsClient_delete(PgsSnapshotsClient *snapshots_client, PgsSnapshot *snapshot, PgsSnapshotsClient_DeleteCallback callback, void *user_data)
void
Asynchronously deletes a snapshot.
PgsSnapshotsClient_discardAndClose(PgsSnapshotsClient *snapshots_client, PgsSnapshot *snapshot, PgsSnapshotsClient_DiscardAndCloseCallback callback, void *user_data)
void
Asynchronously discards and closes a snapshot.
PgsSnapshotsClient_getMaxCoverImageSize(PgsSnapshotsClient *snapshots_client, PgsSnapshotsClient_GetMaxCoverImageSizeCallback callback, void *user_data)
void
Asynchronously loads the maximum size of snapshot cover image in bytes.
PgsSnapshotsClient_getMaxDataSize(PgsSnapshotsClient *snapshots_client, PgsSnapshotsClient_GetMaxDataSizeCallback callback, void *user_data)
void
Asynchronously loads the maximum size of snapshot data.
PgsSnapshotsClient_load(PgsSnapshotsClient *snapshots_client, bool force_reload, PgsSnapshotsClient_LoadCallback callback, void *user_data)
void
Asynchronously loads snapshot data for the currently signed-in player for this application, invoking a callback upon completion.
PgsSnapshotsClient_open(PgsSnapshotsClient *snapshots_client, const char *file_name, bool create_if_not_found, enum PgsSnapshotConflictPolicy conflict_policy, PgsSnapshotsClient_OpenCallback callback, void *user_data)
void
Asynchronously opens a snapshot with given file name.
PgsSnapshotsClient_openFromMetadata(PgsSnapshotsClient *snapshots_client, PgsSnapshotMetadata *metadata, PgsSnapshotsClient_OpenCallback callback, void *user_data)
void
Asynchronously opens a snapshot from metadata with default conflict policy (manual).
PgsSnapshotsClient_openFromMetadataWithPolicy(PgsSnapshotsClient *snapshots_client, PgsSnapshotMetadata *metadata, enum PgsSnapshotConflictPolicy conflict_policy, PgsSnapshotsClient_OpenCallback callback, void *user_data)
void
Asynchronously opens a snapshot from metadata with given conflict policy.
PgsSnapshotsClient_openWithDefaultPolicy(PgsSnapshotsClient *snapshots_client, const char *file_name, bool create_if_not_found, PgsSnapshotsClient_OpenCallback callback, void *user_data)
void
Asynchronously opens a snapshot with given file name and default conflict policy (manual).
PgsSnapshotsClient_resolveConflict(PgsSnapshotsClient *snapshots_client, const char *conflict_id, const char *snapshot_id, PgsSnapshotMetadataChange *metadata_change, PgsSnapshotContents *contents, PgsSnapshotsClient_OpenCallback callback, void *user_data)
void
Asynchronously resolves a snapshot conflict.
PgsSnapshotsClient_showSelectSnapshotUI(PgsSnapshotsClient *snapshots_client, jobject activity, const char *title, bool allow_add_button, bool allow_delete_button, int max_snapshots, PgsSnapshotsClient_ShowSelectSnapshotUICallback callback, void *user_data)
void
Asynchronously shows the snapshot selection UI.

Enumerations

PgsSnapshotConflictPolicy

 PgsSnapshotConflictPolicy

Typedefs

PgsSnapshot

struct PgsSnapshot PgsSnapshot

An opaque handle to a Snapshot.

PgsSnapshotConflict

struct PgsSnapshotConflict PgsSnapshotConflict

An opaque handle to a Snapshot Conflict.

PgsSnapshotContents

struct PgsSnapshotContents PgsSnapshotContents

An opaque handle to Snapshot Contents.

PgsSnapshotsClient_CommitAndCloseCallback

void(* PgsSnapshotsClient_CommitAndCloseCallback)(PgsStatusCode status_code, PgsSnapshotMetadata *metadata, void *user_data)

Callback for PgsSnapshotsClient_commitAndClose.

This is invoked after the asynchronous operation to commit and close completes or fails.

Details
Parameters
status_code
Result of the operation. PGS_STATUS_SUCCESS on success.
metadata
The metadata of committed snapshot, or NULL if status_code is not PGS_STATUS_SUCCESS.
user_data
Pointer to the user-provided data passed in the original call.

PgsSnapshotsClient_DeleteCallback

void(* PgsSnapshotsClient_DeleteCallback)(PgsStatusCode status_code, const char *snapshot_id, void *user_data)

Callback for PgsSnapshotsClient_delete.

This is invoked after the asynchronous operation to delete completes or fails.

Details
Parameters
status_code
Result of the operation. PGS_STATUS_SUCCESS on success.
snapshot_id
The ID of deleted snapshot, or false if status_code is not PGS_STATUS_SUCCESS.
user_data
Pointer to the user-provided data passed in the original call.

PgsSnapshotsClient_DiscardAndCloseCallback

void(* PgsSnapshotsClient_DiscardAndCloseCallback)(PgsStatusCode status_code, void *user_data)

Callback for PgsSnapshotsClient_discardAndClose.

This is invoked after the asynchronous operation to discard and close completes or fails.

Details
Parameters
status_code
Result of the operation. PGS_STATUS_SUCCESS on success.
user_data
Pointer to the user-provided data passed in the original call.

PgsSnapshotsClient_GetMaxCoverImageSizeCallback

void(* PgsSnapshotsClient_GetMaxCoverImageSizeCallback)(PgsStatusCode status_code, int32_t max_size, void *user_data)

Callback for PgsSnapshotsClient_getMaxCoverImageSize.

This is invoked after the asynchronous operation to get max cover image size completes or fails.

Details
Parameters
status_code
Result of the operation. PGS_STATUS_SUCCESS on success.
max_size
The maximum size of snapshot cover image in bytes, or 0 if status_code is not PGS_STATUS_SUCCESS.
user_data
Pointer to the user-provided data passed in the original call.

PgsSnapshotsClient_GetMaxDataSizeCallback

void(* PgsSnapshotsClient_GetMaxDataSizeCallback)(PgsStatusCode status_code, int32_t max_size, void *user_data)

Callback for PgsSnapshotsClient_getMaxDataSize.

This is invoked after the asynchronous operation to get max data size completes or fails.

Details
Parameters
status_code
Result of the operation. PGS_STATUS_SUCCESS on success.
max_size
The maximum size of snapshot data in bytes, or 0 if status_code is not PGS_STATUS_SUCCESS.
user_data
Pointer to the user-provided data passed in the original call.

PgsSnapshotsClient_LoadCallback

void(* PgsSnapshotsClient_LoadCallback)(PgsStatusCode status_code, PgsSnapshotMetadata *snapshots_array, size_t snapshots_count, void *user_data)

Callback for PgsSnapshotsClient_load.

This is invoked after the asynchronous operation to load snapshots completes or fails.

Details
Parameters
status_code
Result of the operation. PGS_STATUS_SUCCESS on success.
snapshots_array
Pointer to an array of PgsSnapshotMetadata objects, or NULL if status_code is not PGS_STATUS_SUCCESS.
snapshots_count
The number of snapshots in snapshots_array.
user_data
Pointer to the user-provided data passed in the original call.

PgsSnapshotsClient_OpenCallback

void(* PgsSnapshotsClient_OpenCallback)(PgsStatusCode status_code, PgsSnapshot *snapshot, PgsSnapshotConflict *conflict, void *user_data)

Callback for PgsSnapshotsClient_open and PgsSnapshotsClient_resolveConflict.

Details
Parameters
status_code
Result of the operation. PGS_STATUS_SUCCESS on success.
snapshot
The opened snapshot, if successful and no conflict. NULL otherwise. The caller is responsible for calling PgsSnapshot_destroy.
conflict
The conflict data, if a conflict occurred. NULL otherwise. The caller is responsible for calling PgsSnapshotConflict_destroy.
user_data
Pointer to the user-provided data passed in the original call.

PgsSnapshotsClient_ShowSelectSnapshotUICallback

void(* PgsSnapshotsClient_ShowSelectSnapshotUICallback)(PgsStatusCode status_code, void *user_data)

Callback for PgsSnapshotsClient_showSelectSnapshotUI.

This is invoked after the asynchronous operation to show select snapshot UI completes or fails.

Details
Parameters
status_code
Result of the operation. PGS_STATUS_SUCCESS on success.
user_data
Pointer to the user-provided data passed in the original call.

Functions

PgsSnapshotConflict_destroy

void PgsSnapshotConflict_destroy(
  PgsSnapshotConflict *conflict
)

Destroys a PgsSnapshotConflict instance.

This function releases all resources associated with the snapshot conflict handle. The handle becomes invalid after this call.

Details
Parameters
conflict
The snapshot conflict handle to destroy.

PgsSnapshotContents_destroy

void PgsSnapshotContents_destroy(
  PgsSnapshotContents *contents
)

Destroys a PgsSnapshotContents instance.

This function releases all resources associated with the snapshot contents handle. The handle becomes invalid after this call.

Details
Parameters
contents
The snapshot contents handle to destroy.

PgsSnapshot_destroy

void PgsSnapshot_destroy(
  PgsSnapshot *snapshot
)

Destroys a PgsSnapshot instance.

This function releases all resources associated with the snapshot handle. The handle becomes invalid after this call.

Details
Parameters
snapshot
The snapshot handle to destroy.

PgsSnapshotsClient_commitAndClose

void PgsSnapshotsClient_commitAndClose(
  PgsSnapshotsClient *snapshots_client,
  PgsSnapshot *snapshot,
  PgsSnapshotMetadataChange *metadata_change,
  const uint8_t *data,
  size_t data_size,
  PgsSnapshotsClient_CommitAndCloseCallback callback,
  void *user_data
)

Asynchronously commits and closes a snapshot.

Details
Parameters
snapshots_client
The client handle.
snapshot
The snapshot to commit and close.
metadata_change
The metadata changes to apply to the snapshot.
data
The binary data to update in the snapshot, or NULL to commit without updating binary data.
data_size
The size of data in bytes. Ignored if data is NULL.
callback
Function to be called with result of asynchronous operation. See PgsSnapshotsClient_CommitAndCloseCallback.
user_data
Arbitrary data pointer to be passed back to callback.

PgsSnapshotsClient_delete

void PgsSnapshotsClient_delete(
  PgsSnapshotsClient *snapshots_client,
  PgsSnapshot *snapshot,
  PgsSnapshotsClient_DeleteCallback callback,
  void *user_data
)

Asynchronously deletes a snapshot.

Details
Parameters
snapshots_client
The client handle.
snapshot
The snapshot to delete.
callback
Function to be called with result of asynchronous operation. See PgsSnapshotsClient_DeleteCallback.
user_data
Arbitrary data pointer to be passed back to callback.

PgsSnapshotsClient_discardAndClose

void PgsSnapshotsClient_discardAndClose(
  PgsSnapshotsClient *snapshots_client,
  PgsSnapshot *snapshot,
  PgsSnapshotsClient_DiscardAndCloseCallback callback,
  void *user_data
)

Asynchronously discards and closes a snapshot.

Details
Parameters
snapshots_client
The client handle.
snapshot
The snapshot to discard and close.
callback
Function to be called with result of asynchronous operation. See PgsSnapshotsClient_DiscardAndCloseCallback.
user_data
Arbitrary data pointer to be passed back to callback.

PgsSnapshotsClient_getMaxCoverImageSize

void PgsSnapshotsClient_getMaxCoverImageSize(
  PgsSnapshotsClient *snapshots_client,
  PgsSnapshotsClient_GetMaxCoverImageSizeCallback callback,
  void *user_data
)

Asynchronously loads the maximum size of snapshot cover image in bytes.

Details
Parameters
snapshots_client
The client handle.
callback
Function to be called with the result of the asynchronous operation. See PgsSnapshotsClient_GetMaxCoverImageSizeCallback.
user_data
Arbitrary data pointer to be passed back to the callback.

PgsSnapshotsClient_getMaxDataSize

void PgsSnapshotsClient_getMaxDataSize(
  PgsSnapshotsClient *snapshots_client,
  PgsSnapshotsClient_GetMaxDataSizeCallback callback,
  void *user_data
)

Asynchronously loads the maximum size of snapshot data.

The returned value is guaranteed to be at least 3MB, but may increase in the future.

Details
Parameters
snapshots_client
The client handle.
callback
Function to be called with the result of the asynchronous operation. See PgsSnapshotsClient_GetMaxDataSizeCallback.
user_data
Arbitrary data pointer to be passed back to the callback.

PgsSnapshotsClient_load

void PgsSnapshotsClient_load(
  PgsSnapshotsClient *snapshots_client,
  bool force_reload,
  PgsSnapshotsClient_LoadCallback callback,
  void *user_data
)

Asynchronously loads snapshot data for the currently signed-in player for this application, invoking a callback upon completion.

Details
Parameters
snapshots_client
The client handle.
force_reload
If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching.
callback
Function to be called with the result of the asynchronous operation. See PgsSnapshotsClient_LoadCallback.
user_data
Arbitrary data pointer to be passed back to the callback.

PgsSnapshotsClient_open

void PgsSnapshotsClient_open(
  PgsSnapshotsClient *snapshots_client,
  const char *file_name,
  bool create_if_not_found,
  enum PgsSnapshotConflictPolicy conflict_policy,
  PgsSnapshotsClient_OpenCallback callback,
  void *user_data
)

Asynchronously opens a snapshot with given file name.

Details
Parameters
snapshots_client
The client handle.
file_name
The file name of snapshot to open.
create_if_not_found
If true, new snapshot will be created if one does not exist.
conflict_policy
Policy for resolving conflicts. See PgsSnapshotConflictPolicy.
callback
Function to be called with result of asynchronous operation. See PgsSnapshotsClient_OpenCallback.
user_data
Arbitrary data pointer to be passed back to callback.

PgsSnapshotsClient_openFromMetadata

void PgsSnapshotsClient_openFromMetadata(
  PgsSnapshotsClient *snapshots_client,
  PgsSnapshotMetadata *metadata,
  PgsSnapshotsClient_OpenCallback callback,
  void *user_data
)

Asynchronously opens a snapshot from metadata with default conflict policy (manual).

Details
Parameters
snapshots_client
The client handle.
metadata
The metadata of the snapshot to open.
callback
Function to be called with result of asynchronous operation. See PgsSnapshotsClient_OpenCallback.
user_data
Arbitrary data pointer to be passed back to callback.

PgsSnapshotsClient_openFromMetadataWithPolicy

void PgsSnapshotsClient_openFromMetadataWithPolicy(
  PgsSnapshotsClient *snapshots_client,
  PgsSnapshotMetadata *metadata,
  enum PgsSnapshotConflictPolicy conflict_policy,
  PgsSnapshotsClient_OpenCallback callback,
  void *user_data
)

Asynchronously opens a snapshot from metadata with given conflict policy.

Details
Parameters
snapshots_client
The client handle.
metadata
The metadata of the snapshot to open.
conflict_policy
Policy for resolving conflicts. See PgsSnapshotConflictPolicy.
callback
Function to be called with result of asynchronous operation. See PgsSnapshotsClient_OpenCallback.
user_data
Arbitrary data pointer to be passed back to callback.

PgsSnapshotsClient_openWithDefaultPolicy

void PgsSnapshotsClient_openWithDefaultPolicy(
  PgsSnapshotsClient *snapshots_client,
  const char *file_name,
  bool create_if_not_found,
  PgsSnapshotsClient_OpenCallback callback,
  void *user_data
)

Asynchronously opens a snapshot with given file name and default conflict policy (manual).

Details
Parameters
snapshots_client
The client handle.
file_name
The file name of snapshot to open.
create_if_not_found
If true, new snapshot will be created if one does not exist.
callback
Function to be called with result of asynchronous operation. See PgsSnapshotsClient_OpenCallback.
user_data
Arbitrary data pointer to be passed back to callback.

PgsSnapshotsClient_resolveConflict

void PgsSnapshotsClient_resolveConflict(
  PgsSnapshotsClient *snapshots_client,
  const char *conflict_id,
  const char *snapshot_id,
  PgsSnapshotMetadataChange *metadata_change,
  PgsSnapshotContents *contents,
  PgsSnapshotsClient_OpenCallback callback,
  void *user_data
)

Asynchronously resolves a snapshot conflict.

Details
Parameters
snapshots_client
The client handle.
conflict_id
The ID of the conflict to resolve.
snapshot_id
The ID of the snapshot to use for resolution.
metadata_change
The metadata changes to apply to the snapshot, or NULL for no changes.
contents
The contents to resolve the conflict with.
callback
Function to be called with result of asynchronous operation. See PgsSnapshotsClient_OpenCallback.
user_data
Arbitrary data pointer to be passed back to callback.

PgsSnapshotsClient_showSelectSnapshotUI

void PgsSnapshotsClient_showSelectSnapshotUI(
  PgsSnapshotsClient *snapshots_client,
  jobject activity,
  const char *title,
  bool allow_add_button,
  bool allow_delete_button,
  int max_snapshots,
  PgsSnapshotsClient_ShowSelectSnapshotUICallback callback,
  void *user_data
)

Asynchronously shows the snapshot selection UI.

Details
Parameters
snapshots_client
The client handle.
activity
The activity to use for launching the UI.
title
The title for the UI.
allow_add_button
Whether to allow adding snapshots.
allow_delete_button
Whether to allow deleting snapshots.
max_snapshots
The maximum number of snapshots to display.
callback
Function to be called with result of asynchronous operation. See PgsSnapshotsClient_ShowSelectSnapshotUICallback.
user_data
Arbitrary data pointer to be passed back to callback.