Show / Hide Table of Contents

Class AN_SnapshotsClient

A client to interact with Snapshots.

Inheritance
System.Object
AN_SnapshotsClient
Namespace: SA.Android.GMS.Games
Assembly: cs.temp.dll.dll
Syntax
public class AN_SnapshotsClient : AN_LinkedObject

Fields

DISPLAY_LIMIT_NONE

Constant passed to ShowSelectSnapshotIntent(String, Boolean, Boolean, Int32, Action<AN_SnapshotUIResult>) indicating that the UI should not cap the number of displayed snapshots.

Declaration
public const int DISPLAY_LIMIT_NONE = -1
Field Value
Type Description
System.Int32

Methods

CommitAndClose(AN_Snapshot, AN_SnapshotMetadataChange, Action<AN_SnapshotMetadataResult>)

Asynchronously commits any modifications in AN_SnapshotMetadataChange made to the AN_Snapshot and loads a AN_SnapshotMetadata. The callback returned by this method is complete once the changes are synced locally and the background sync request for this data has been requested.

This method fails a task with an exception when called with a snapshot that was not opened or has already been committed/discarded.

Note that the total size of the contents of snapshot may not exceed the size provided GetMaxDataSize()

Declaration
public void CommitAndClose(AN_Snapshot snapshot, AN_SnapshotMetadataChange metadataChange, Action<AN_SnapshotMetadataResult> callback)
Parameters
Type Name Description
AN_Snapshot snapshot

The snapshot to commit the data for.

AN_SnapshotMetadataChange metadataChange

The set of changes to apply to the metadata for the snapshot. Use EMPTY_CHANGE to preserve the existing metadata.

Action<AN_SnapshotMetadataResult> callback

The operation callback.

Delete(AN_SnapshotMetadata, Action<AN_SnapshotsDeleteResult>)

Asynchronously deletes the specified by AN_SnapshotMetadata snapshot and loads the deleted snapshot ID. This will delete the data of the snapshot locally and on the server.

Declaration
public void Delete(AN_SnapshotMetadata meta, Action<AN_SnapshotsDeleteResult> callback)
Parameters
Type Name Description
AN_SnapshotMetadata meta

The metadata of the snapshot to delete.

Action<AN_SnapshotsDeleteResult> callback

The operation callback.

GetMaxDataSize()

Asynchronously loads the maximum data size per snapshot in bytes. Guaranteed to be at least 3 MB. May increase in the future.

Declaration
public void GetMaxDataSize()

Load(Action<AN_SnapshotsMetadataResult>)

Asynchronously loads list of AN_SnapshotMetadata that represents the snapshot data for the currently signed-in player. Required Scopes: SCOPE_GAMES_LITE and SCOPE_APPFOLDER.

Declaration
public void Load(Action<AN_SnapshotsMetadataResult> callback)
Parameters
Type Name Description
Action<AN_SnapshotsMetadataResult> callback

The task callback

Load(Boolean, Action<AN_SnapshotsMetadataResult>)

Asynchronously loads list of AN_SnapshotMetadata that represents the snapshot data for the currently signed-in player. Required Scopes: SCOPE_GAMES_LITE and SCOPE_APPFOLDER. 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. The task callback

Declaration
public void Load(bool forceReload, Action<AN_SnapshotsMetadataResult> callback)
Parameters
Type Name Description
System.Boolean forceReload
Action<AN_SnapshotsMetadataResult> callback

Open(String, Boolean, AN_SnapshotsClient.ResolutionPolicy, Action<AN_LinkedObjectResult<AN_DataOrConflictResult>>)

Starts a task which asynchronously opens a snapshot with the given fileName. If createIfNotFound is set to true, the specified snapshot will be created if it does not already exist.

Required Scopes: SCOPE_GAMES_LITE and SCOPE_APPFOLDER.

Declaration
public void Open(string fileName, bool createIfNotFound, AN_SnapshotsClient.ResolutionPolicy conflictPolicy, Action<AN_LinkedObjectResult<AN_DataOrConflictResult>> callback)
Parameters
Type Name Description
System.String fileName

The name of the snapshot file to open. Must be between 1 and 100 non-URL-reserved characters (a-z, A-Z, 0-9, or the symbols "-", ".", "_", or "~").

System.Boolean createIfNotFound

If true, the snapshot will be created if one cannot be found.

AN_SnapshotsClient.ResolutionPolicy conflictPolicy

The conflict resolution policy to use for this snapshot.

Action<AN_LinkedObjectResult<AN_DataOrConflictResult>> callback

The task callback.

ResolveConflict(String, AN_Snapshot, Action<AN_LinkedObjectResult<AN_DataOrConflictResult>>)

Starts a task which asynchronously resolves a conflict using the data from the provided Snapshot.

This will replace the data on the server with the specified Snapshot. Note that it is possible for this operation to result in a conflict itself, in which case resolution should be repeated.

Declaration
public void ResolveConflict(string conflictId, AN_Snapshot snapshot, Action<AN_LinkedObjectResult<AN_DataOrConflictResult>> callback)
Parameters
Type Name Description
System.String conflictId

he ID of the conflict to resolve. Must come from AN_SnapshotConflict

AN_Snapshot snapshot

The snapshot to use to resolve the conflict.

Action<AN_LinkedObjectResult<AN_DataOrConflictResult>> callback

The task callback.

ShowSelectSnapshotIntent(String, Action<AN_SnapshotUIResult>)

Shows the UI that will let the user select a snapshot.

If the user canceled without selecting a snapshot, the result state will be NOTHING_SELECTED. If the user selected a snapshot from the list, the result state will be EXTRA_SNAPSHOT_METADATA. If the user pressed the add button, the result state will be EXTRA_SNAPSHOT_NEW. See the

Declaration
public void ShowSelectSnapshotIntent(string title, Action<AN_SnapshotUIResult> callback)
Parameters
Type Name Description
System.String title

The title to display in the action bar of the returned Activity.

Action<AN_SnapshotUIResult> callback

User interaction callback

ShowSelectSnapshotIntent(String, Boolean, Boolean, Int32, Action<AN_SnapshotUIResult>)

Shows the UI that will let the user select a snapshot.

If the user canceled without selecting a snapshot, the result state will be NOTHING_SELECTED. If the user selected a snapshot from the list, the result state will be EXTRA_SNAPSHOT_METADATA. If the user pressed the add button, the result state will be EXTRA_SNAPSHOT_NEW. See the

Declaration
public void ShowSelectSnapshotIntent(string title, bool allowAddButton, bool allowDelete, int maxSnapshots, Action<AN_SnapshotUIResult> callback)
Parameters
Type Name Description
System.String title

The title to display in the action bar of the returned Activity.

System.Boolean allowAddButton

Whether or not to display a "create new snapshot" option in the selection UI.

System.Boolean allowDelete

Whether or not to provide a delete overflow menu option for each snapshot in the selection UI.

System.Int32 maxSnapshots

The maximum number of snapshots to display in the UI. Use DISPLAY_LIMIT_NONE to display all snapshots.

Action<AN_SnapshotUIResult> callback

User interaction callback

In This Article
Back to top Generated by DocFX