GooglePlayGameService
GPGSAbstractDataBuffer
Functions:
- Get (position As Int) As Object
Get the item from the particular position.
If the buffer is not loaded yet it will return null.
position: The index of the item.
- GetCount As Int
Returns the item count of the buffer.
If the buffer is not loaded yet it will return 0.
- GetObject As Object
Get the underlying native buffer object.
If the buffer is not loaded yet it will return null.
position: The index of the item.
- Release
Release the buffer.
GPGSAchievement
Events:
- RevealedImageLoaded (uri As String, isBitmap As Boolean)
- UnlockedImageLoaded (uri As String, isBitmap As Boolean)
Fields:
- STATE_HIDDEN As Int
- STATE_REVEALED As Int
- STATE_UNLOCKED As Int
- TYPE_INCREMENTAL As Int
- TYPE_STANDARD As Int
Functions:
- GetAchievementId As String
Retrieves the ID of this achievement.
- GetCurrentSteps As Int
Retrieves the number of steps this user has gone toward unlocking this achievement; only applicable for TYPE_INCREMENTAL achievement types.
- GetDescription As String
Retrieves the description for this achievement.
- GetFormattedCurrentSteps As String
Retrieves the number of steps this user has gone toward unlocking this achievement (formatted for the user's locale); only applicable for TYPE_INCREMENTAL achievement types.
- GetFormattedTotalSteps As String
Retrieves the total number of steps necessary to unlock this achievement, formatted for the user's locale; only applicable for TYPE_INCREMENTAL achievement types.
- GetLastUpdatedTimestamp As Long
Retrieves the timestamp (in milliseconds since epoch) at which this achievement was last updated. If the achievement has never been updated, this will return -1.
- GetName As String
Retrieves the name of this achievement.
- GetPlayer As GPGSPlayer
Retrieves the player information associated with this achievement.
- GetRevealedImageUri As String
Retrieves a URI that can be used to load the achievement's revealed image icon. Returns null if the achievement has no revealed image.
- GetState As Int
Retrieves the state of the achievement.
- GetTotalSteps As Int
Retrieves the total number of steps necessary to unlock this achievement; only applicable for TYPE_INCREMENTAL achievement types.
- GetType As Int
Retrieves the type of this achievement.
- GetUnlockedImageUri As String
Retrieves a URI that can be used to load the achievement's unlocked image icon. Returns null if the achievement has no unlocked image.
- GetXpValue As Long
Retrieves the XP value given to players for unlocking this achievement.
- IsInitialized As Boolean
- SetRevealedImage (IV As ImageView)
Set the achievement's revealed image icon to the give image view.
RevealedImageLoaded event will be raised.
IV: ImageView on which you want to load the icon.
- SetUnlockedImage (IV As ImageView)
Set the achievement's unlocked image icon to the give image view.
UnlockedImageLoaded event will be raised.
IV: ImageView on which you want to load the icon.
GPGSAchievementsClient
Events:
- AchievementIncrementCompleted (achievementId As String, unlocked As Boolean, statusCode As Int)
- AchievementRevealed (achievementId As String, statusCode As Int)
- AchievementsLoaded (count As Int, statusCode As Int)
- AchievementStepsChanged (achievementId As String, changed As Boolean, statusCode As Int)
- AchievementUnlocked (achievementId As String, statusCode As Int)
- ReceivedAchievementsIntent (intent As Intent, statusCode As Int)
Functions:
- GetAchievementFromBuffer (position As Int) As GPGSAchievement
Get the Achievement object from the buffer.
If the buffer is not loaded yet it will return null. Call Load to populate the buffer.
position: Position of the item.
- GetAchievementsBuffer As GPGSAbstractDataBuffer
Returns the achievements buffer.
If the buffer is not loaded yet it will return null. Call Load to populate the buffer.
- GetAchievementsIntent
Asynchronously loads an Intent to show the list of achievements for a game.
Note that the Intent returned from the Task must be invoked with GPGSGames.StartActivityForResult,
so that the identity of the calling package can be established.
ReceivedAchievementsIntent event will be raised.
- Increment (achievementId As String, numSteps As Int)
Increments an achievement by the given number of steps.
The achievement must be an incremental achievement. Once an achievement reaches at least the maximum number of steps,
it will be unlocked automatically. Any further increments will be ignored.
achievementId: The ID of the achievement to increment.
numSteps: The number of steps to increment by. Must be greater than 0.
- IncrementImmediate (achievementId As String, numSteps As Int)
Asynchronously increments an achievement by the given number of steps.
The achievement must be an incremental achievement. Once an achievement reaches at least the maximum number of steps,
it will be unlocked automatically. Any further increments will be ignored.
AchievementIncrementCompleted event will be raised.
achievementId: The ID of the achievement to increment.
numSteps: The number of steps to increment by. Must be greater than 0.
- IsInitialized As Boolean
- Load (forceReload As Boolean)
Asynchronously loads a list of achievements for the currently signed-in player.
Note: You can't store the returned buffer to any list or array. Use GetAchievementFromBuffer to retrieve the items.
Important: Remember to close the buffer by calling Release after you finish working with the buffer data.
AchievementsLoaded event will be raised.
forceReload: 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.
- Reveal (achievementId As String)
Reveals a hidden achievement to the currently signed-in player. If the achievement has already been unlocked, this will have no effect.
achievementId: The achievement ID to reveal.
- RevealImmediate (achievementId As String)
Asynchronously reveals a hidden achievement to the currently signed in player. If the achievement is already visible, this will have no effect.
AchievementRevealed event will be raised.
achievementId: The achievement ID to reveal.
- SetSteps (achievementId As String, numSteps As Int)
Sets an achievement to have at least the given number of steps completed.
Calling this method while the achievement already has more steps than the provided value is a no-op.
Once the achievement reaches the maximum number of steps, the achievement will automatically be unlocked, and any further mutation operations will be ignored.
achievementId: The ID of the achievement to modify.
numSteps: The number of steps to set the achievement to. Must be greater than 0.
- SetStepsImmediate (achievementId As String, numSteps As Int)
Asynchronously sets an achievement to have at least the given number of steps completed.
Calling this method while the achievement already has more steps than the provided value is a no-op.
Once the achievement reaches the maximum number of steps, the achievement will automatically be unlocked, and any further mutation operations will be ignored.
AchievementStepsChanged event will be raised.
achievementId: The ID of the achievement to modify.
numSteps: The number of steps to set the achievement to. Must be greater than 0.
- Unlock (achievementId As String)
Unlocks an achievement for the currently signed in player. If the achievement is hidden this will reveal it to the player.
achievementId: The achievement ID to unlock.
- UnlockImmediate (achievementId As String)
Asynchronously unlocks an achievement for the currently signed in player. If the achievement is hidden this will reveal it to the player.
AchievementUnlocked event will be raised.
achievementId: The achievement ID to unlock.
GPGSEvent
Events:
- EventIconImageLoaded (uri As String, isBitmap As Boolean)
Functions:
- GetDescription As String
Retrieves the description for this event.
- GetEventId As String
Retrieves the ID of this event.
- GetFormattedValue As String
Retrieves the sum of increments have been made to this event (formatted for the user's locale).
- GetIconImageUri As String
Retrieves a URI that can be used to load the event's image icon. Returns null if the event has no image.
- GetName As String
Retrieves the name of this event.
- GetPlayer As GPGSPlayer
Retrieves the player information associated with this event. Note that this object is a volatile representation, so it is not safe to cache the output of this directly.
- GetValue As Long
Retrieves the number of increments this user has made to this event.
- IsInitialized As Boolean
- IsVisible As Boolean
Retrieves whether the event should be displayed to the user in any event related UIs.
- SetIconImage (IV As ImageView)
Set the event's icon image to the give image view.
EventIconImageLoaded event will be raised.
IV: ImageView on which you want to load the icon.
GPGSEventsClient
Events:
- EventsLoaded (count As Int, statusCode As Int)
Functions:
- GetEventFromBuffer (position As Int) As GPGSEvent
Get the event object from the buffer.
If the buffer is not loaded yet it will return null. Call Load to populate the buffer.
position: Position of the item.
- GetEventsBuffer As GPGSAbstractDataBuffer
Returns the events buffer.
If the buffer is not loaded yet it will return null. Call Load to populate the buffer.
- Increment (eventId As String, incrementAmount As Int)
Increments an event specified by eventId by the given number of steps.
This is the fire-and-forget API. Event increments are cached locally and flushed to the server in batches.
eventId: The event ID to increment.
incrementAmount: The amount increment by. Must be greater than or equal to 0.
- IsInitialized As Boolean
- Load (forceReload As Boolean)
Asynchronously load an annotated EventBuffer that represents the event data for the currently signed-in player.
Note: You can't store the returned buffer to any list or array. Use GetEventFromBuffer to retrieve the items.
Important: Remember to close the buffer by calling Release after you finish working with the buffer data.
EventsLoaded event will be raised.
forceReload: 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.
- LoadByIds (forceReload As Boolean, eventIds As String())
Asynchronously load an annotated EventBuffer that represents the event data for the specified event IDs.
EventsLoaded event will be raised.
forceReload: 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.
eventIds: The IDs of the events to load.
GPGSGame
Events:
- GameFeaturedImageLoaded (uri As String, isBitmap As Boolean)
- GameHiresImageLoaded (uri As String, isBitmap As Boolean)
- GameIconImageLoaded (uri As String, isBitmap As Boolean)
Functions:
- AreSnapshotsEnabled As Boolean
Indicates whether or not this game supports snapshots.
- GetAchievementTotalCount As Int
Retrieves the number of achievements registered for this game.
- GetApplicationId As String
Retrieves the application ID for this game.
- GetDescription As String
Retrieves the description of this game.
- GetDeveloperName As String
Retrieves the name of the developer of this game.
- GetDisplayName As String
Retrieves the display name for this game.
- GetFeaturedImageUri As String
Retrieves an image URI that can be used to load the game's featured (banner) image from Google Play. Returns null if game has no featured image.
- GetHiResImageUri As String
Retrieves an image URI that can be used to load the game's hi-res image. Returns null if game has no hi-res image.
- GetIconImageUri As String
Retrieves an image URI that can be used to load the game's icon image. Returns null if game has no icon image.
- GetLeaderboardCount As Int
Gets the number of leaderboards registered for this game.
- GetPrimaryCategory As String
Retrieves the primary category of the game - this is may be null.
- GetSecondaryCategory As String
Retrieves the secondary category of the game - this may be null.
- GetThemeColor As String
Retrieves the theme color for this game. The theme color is used to configure the appearance of Play Games UIs.
- HasGamepadSupport As Boolean
Indicates whether or not this game is marked as supporting gamepads.
- IsInitialized As Boolean
- SetFeaturedImage (IV As ImageView)
Set the game's featured (banner) image from Google Play to the give image view.
GameFeaturedImageLoaded event will be raised.
IV: ImageView on which you want to load the icon.
- SetHiResImage (IV As ImageView)
Set the game's hi-res image to the give image view.
GameHiresImageLoaded event will be raised.
IV: ImageView on which you want to load the icon.
- SetIconImage (IV As ImageView)
Set the game's icon image to the give image view.
GameIconImageLoaded event will be raised.
IV: ImageView on which you want to load the icon.
GPGSGames
Events:
- OnGPGSActivityResult (RequestCode As String, ResultCode As Int, ResultIntent As Intent)
Functions:
- GetAchievementsClient As GPGSAchievementsClient
Returns a new instance of AchievementsClient for use in a Context.
- GetAchievementsClientWithConnectionPopup (showConnectingPopup As Boolean, gravity As Int) As GPGSAchievementsClient
Returns a new instance of AchievementsClient for use in a Context.
- GetEventsClient As GPGSEventsClient
Returns a new instance of EventsClient for use in a Context.
- GetEventsClientWithConnectionPopup (showConnectingPopup As Boolean, gravity As Int) As GPGSEventsClient
Returns a new instance of EventsClient for use in a Context.
- GetGamesClient As GPGSGamesClient
Returns a new instance of GamesClient for use in a Context.
- GetGamesClientWithConnectionPopup (showConnectingPopup As Boolean, gravity As Int) As GPGSGamesClient
Returns a new instance of GamesClient for use in a Context.
- GetGamesMetadataClient As GPGSGamesMetadataClient
Returns a new instance of GamesMetadataClient for use in a Context.
- GetGamesMetadataClientWithConnectionPopup (showConnectingPopup As Boolean, gravity As Int) As GPGSGamesMetadataClient
Returns a new instance of GamesMetadataClient for use in a Context.
- GetLeaderboardsClient As GPGSLeaderboardsClient
Returns a new instance of LeaderboardsClient for use in a Context.
- GetLeaderboardsClientWithConnectionPopup (showConnectingPopup As Boolean, gravity As Int) As GPGSLeaderboardsClient
Returns a new instance of LeaderboardsClient for use in a Context.
- GetPlayersClient As GPGSPlayersClient
Returns a new instance of PlayersClient for use in a Context.
- GetPlayersClientWithConnectionPopup (showConnectingPopup As Boolean, gravity As Int) As GPGSPlayersClient
Returns a new instance of PlayersClient for use in a Context.
- GetPlayerStatsClient As GPGSPlayerStatsClient
Returns a new instance of PlayerStatsClient for use in a Context.
- GetPlayerStatsClientWithConnectionPopup (showConnectingPopup As Boolean, gravity As Int) As GPGSPlayerStatsClient
Returns a new instance of PlayerStatsClient for use in a Context.
- GetSnapshotsClient As GPGSSnapshotsClient
Returns a new instance of SnapshotsClient for use in a Context.
- GetSnapshotsClientWithConnectionPopup (showConnectingPopup As Boolean, gravity As Int) As GPGSSnapshotsClient
Returns a new instance of SnapshotsClient for use in a Context.
- GetVideosClient As GPGSVideosClient
Returns a new instance of VideosClient for use in a Context.
- GetVideosClientWithConnectionPopup (showConnectingPopup As Boolean, gravity As Int) As GPGSVideosClient
Returns a new instance of VideosClient for use in a Context.
- StartActivityForResult (intent As Intent, requestCode As String)
Launch an activity for which you would like a result when it finished.
When this activity exits, your OnGPGSActivityResult event will be raised with the given requestCode.
intent: The intent to start.
requestCode: This code will be returned in OnGPGSActivityResult when the activity exits. You can check this to verify which activity exited.
GPGSGamesClient
Events:
- AccountNameReceived (name As String, statusCode As Int)
- ActivationHintReceived (snapshotMetadata As GPGSSnapshotMetadata, statusCode As Int)
- AppIdReceived (appId As String, statusCode As Int)
- SettingsIntentReceived (intent As Intent, statusCode As Int)
Functions:
- GetActivationHint
Asynchronously loads a Bundle that may contain an information regarding to the previous user's action.
The GPGSSnapshotMetadata returned from the Task may be null if it was already received or there is no related data found.
Unless a new user action is performed all the subsequent calls will return a Task with a null GPGSSnapshotMetadata.
ActivationHintReceived event will be raised.
- GetAppId
Asynchronously loads the application ID linked to this client instance.
AppIdReceived event will be raised.
- GetCurrentAccountName
Asynchronously loads the name of the currently selected account. This is the account the user has chosen to use for Google Play Games.
Note that your app must have android.permission.GET_ACCOUNTS declared in your manifest in order to use this method. Otherwise the Task will fail.
AccountNameReceived event will be raised.
- GetSettingsIntent
Asynchronously loads an Intent to show the Settings screen that allows the user to configure Games-related features for the current game.
Note that this must be invoked with GPGSGames.StartActivityForResult, so that the identity of the calling package can be established.
SettingsIntentReceived event will be raised.
- IsInitialized As Boolean
- SetGravityForPopups (gravity As Int)
Asynchronously sets the part of the screen at which games service pop-ups (for example, "welcome back" or "achievement unlocked" popups) will be displayed using gravity.
gravity: The gravity which controls the placement of games service pop-ups.
- SetViewForPopups (view As android.view.ViewGroup)
Asynchronously sets the View to use as a content view for popups.
view: The view to use as a content view for popups. View cannot be null.
GPGSGamesMetadataClient
Events:
- CurrentGameMetadataLoaded (game As GPGSGame, fromLocalCache As Boolean, statusCode As Int)
Functions:
- GetCurrentGame
Asynchronously loads the GPGSGame for the current game from the local cache.
The game returned from the Task may be null if the metadata is not available locally.
CurrentGameMetadataLoaded event will be raised.
- IsInitialized As Boolean
- LoadGame
Asynchronously loads an annotated GPGSGame for the current game.
CurrentGameMetadataLoaded event will be raised.
GPGSLeaderboard
Events:
- LeaderboardIconImageLoaded (uri As String, isBitmap As Boolean)
Fields:
- SCORE_ORDER_LARGER_IS_BETTER As Int
Score order constant for leaderboards where scores are sorted in descending order.
- SCORE_ORDER_SMALLER_IS_BETTER As Int
Score order constant for leaderboards where scores are sorted in ascending order.
Functions:
- GetDisplayName As String
Retrieves the display name of this leaderboard.
- GetIconImageUri As String
Retrieves an image URI that can be used to load the leaderboard's icon image. Returns null if leaderboard has no icon image.
- GetLeaderboardId As String
Retrieves the ID of this leaderboard.
- GetScoreOrder As Int
Retrieves the sort order of scores for this leaderboard. Possible values are SCORE_ORDER_LARGER_IS_BETTER or SCORE_ORDER_SMALLER_IS_BETTER.
- GetVariants As List
Retrieves a list of GPGSLeaderboardVariants for this leaderboard. These will be returned sorted by time span first, then by variant type. Note that these variants are volatile, and are tied to the lifetime of the original buffer.
- IsInitialized As Boolean
- SetIconImage (IV As ImageView)
Set the leaderboard's icon image to the give image view.
LeaderboardIconImageLoaded event will be raised.
IV: ImageView on which you want to load the icon.
GPGSLeaderboardScore
Events:
- PlayerProfileImageLoaded (uri As String, isBitmap As Boolean)
Fields:
- LEADERBOARD_RANK_UNKNOWN As Int
Constant indicating that the score holder's rank was not known.
Functions:
- GetDisplayRank As String
Retrieves a formatted string to display for this rank. This handles appropriate localization and formatting.
- GetDisplayScore As String
Retrieves a formatted string to display for this score. The details of the formatting are specified by the developer in their dev console.
- GetRank As Long
Retrieves the rank returned from the server for this score. Note that this may not be exact and that multiple scores can have identical ranks. Lower ranks indicate a better score, with rank 1 being the best score on the board. If the score holder's rank cannot be determined, this will return LEADERBOARD_RANK_UNKNOWN.
- GetRawScore As Long
Retrieves the raw score value.
- GetScoreHolder As GPGSPlayer
Retrieves the player that scored this particular score. The return value here may be null if the current player is not authorized to see information about the holder of this score. Note that this object is a volatile representation, so it is not safe to cache the output of this directly.
- GetScoreHolderDisplayName As String
Retrieves the name to display for the player who scored this score. If the identity of the player is unknown, this will return an anonymous name to display.
- GetScoreHolderImageUri (hiRes As Boolean) As String
Retrieves the URI of the image to display for the player who scored this score. If the identity of the player is unknown, this will return null. It may also be null if the player simply has no image.
hiRes: If true will load HD image else icon-size image.
- GetScoreTag As String
Retrieve the optional score tag associated with this score, if any.
- GetTimestampMillis As Long
Retrieves the timestamp (in milliseconds from epoch) at which this score was achieved.
- IsInitialized As Boolean
- SetScoreHolderImage (hiRes As Boolean, IV As ImageView)
Set player's profile image to the give image view who scored this score.
PlayerProfileImageLoaded event will be raised.
hiRes: If true will load HD image else icon-size image.
IV: ImageView on which you want to load the image.
GPGSLeaderboardVariant
Fields:
- COLLECTION_FRIENDS As Int
Collection constant for friends leaderboards. These leaderboards contain the scores of players in the viewing player's friends list.
- COLLECTION_PUBLIC As Int
Collection constant for public leaderboards. Public leaderboards contain the scores of players who are sharing their gameplay activity publicly.
- NUM_SCORES_UNKNOWN As Int
Constant returned when the total number of scores for this variant is unknown.
- NUM_TIME_SPANS As Int
Number of time spans that exist. Needs to be updated if we ever have more.
- PLAYER_RANK_UNKNOWN As Int
Constant returned when a player's rank for this variant is unknown.
- PLAYER_SCORE_UNKNOWN As Int
Constant returned when a player's score for this variant is unknown.
- TIME_SPAN_ALL_TIME As Int
Scores are never reset.
- TIME_SPAN_DAILY As Int
Scores are reset every day. The reset occurs at 11:59PM PST.
- TIME_SPAN_WEEKLY As Int
Scores are reset once per week. The reset occurs at 11:59PM PST on Sunday.
Functions:
- hasPlayerInfo As Boolean
Get whether or not this variant contains score information for the viewing player or not. There are several possible reasons why this might be false. If the scores for this variant have never been loaded, we won't know if the player has a score or not. Similarly, if the player has not submitted a score for this variant, this will return false. It is possible to have a score but no rank. For instance, on leaderboard variants of COLLECTION_PUBLIC, players who are not sharing their scores publicly will never have a rank.
- IsInitialized As Boolean
Properties:
- Collection As Int [read only]
Retrieves the collection of scores contained by this variant. Possible values are COLLECTION_PUBLIC or COLLECTION_FRIENDS.
- DisplayPlayerRank As String [read only]
Retrieves the viewing player's formatted rank for this variant, if any. Note that this value is only accurate if hasPlayerInfo() returns true.
- DisplayPlayerScore As String [read only]
Retrieves the viewing player's score for this variant, if any. Note that this value is only accurate if hasPlayerInfo() returns true.
- NumScores As Long [read only]
Retrieves the total number of scores for this variant. Not all of these scores will always be present on the local device. Note that if scores for this variant have not been loaded, this method will return NUM_SCORES_UNKNOWN.
- PlayerRank As Long [read only]
Retrieves the viewing player's rank for this variant, if any. Note that this value is only accurate if hasPlayerInfo() returns true. The long representation of the viewing player's rank, or PLAYER_RANK_UNKNOWN if the player has no rank for this variant.
- PlayerScoreTag As String [read only]
Retrieves the viewing player's score tag for this variant, if any. Note that this value is only accurate if hasPlayerInfo() returns true. The score tag associated with the viewing player's score, or null if the player has no score for this variant.
- RawPlayerScore As Long [read only]
Retrieves the viewing player's score for this variant, if any. Note that this value is only accurate if hasPlayerInfo() returns true. The long representation of the viewing player's score, or PLAYER_SCORE_UNKNOWN if the player has no score for this variant.
- TimeSpan As Int [read only]
Retrieves the time span that the scores for this variant are drawn from. Possible values are TIME_SPAN_ALL_TIME, TIME_SPAN_WEEKLY, or TIME_SPAN_DAILY.
GPGSLeaderboardsClient
Events:
- AllLeaderboardMetadataLoaded (count As Int, statusCode As Int)
- CurrentPlayerLeaderboardScoreLoaded (score As GPGSLeaderboardScore)
- CurrentPlayerLeaderboardScoreLoadFailed (showingConsent As Boolean, statusCode As Int)
- FriendsAccessPermissionGranted (granted As Boolean)
- LeaderboardMetadataLoaded (leaderboard As GPGSLeaderboard, statusCode As Int)
- PlayerCenteredScoresLoaded (count As Int)
- PlayerCenteredScoresLoadFailed (showingConsent As Boolean, statusCode As Int)
- ReceivedAllLeaderboardsIntent (intent As Intent, statusCode As Int)
- ReceivedLeaderboardsIntent (intent As Intent, statusCode As Int)
- ScoreSubmitted (submissionData As GPGSScoreSubmissionData, statusCode As Int)
- TopScoresLoaded (count As Int)
- TopScoresLoadFailed (showingConsent As Boolean, statusCode As Int)
Fields:
- COLLECTION_FRIENDS As Int
Collection constant for friends leaderboards. These leaderboards contain the scores of players in the viewing player's friends list.
- COLLECTION_PUBLIC As Int
Collection constant for public leaderboards. Public leaderboards contain the scores of players who are sharing their gameplay activity publicly.
- PAGE_DIRECTION_NEXT As Int
Direction next
- PAGE_DIRECTION_PREV As Int
Direction previous
- TIME_SPAN_ALL_TIME As Int
Scores are never reset.
- TIME_SPAN_DAILY As Int
Scores are reset every day. The reset occurs at 11:59PM PST.
- TIME_SPAN_WEEKLY As Int
Scores are reset once per week. The reset occurs at 11:59PM PST on Sunday.
Functions:
- GetAllLeaderboardsIntent
Asynchronously loads an Intent to show the list of leaderboards for a game. Note that this must be invoked with GPGSGames.StartActivityForResult, so that the identity of the calling package can be established.
ReceivedAllLeaderboardsIntent event will be raised.
- GetLeaderboardFromBuffer (position As Int) As GPGSLeaderboard
Get the leaderboard object from the buffer.
If the buffer is not loaded yet it will return null. Call LoadLeaderboardMetadata to populate the buffer.
position: Position of the item.
- GetLeaderboardIntent (leaderboardId As String)
Asynchronously loads an Intent to show a leaderboard for a game specified by a leaderboardId. Note that this must be invoked with GPGSGames.StartActivityForResult, so that the identity of the calling package can be established.
ReceivedLeaderboardsIntent event will be raised.
leaderboardId: The ID of the leaderboard to view.
- GetLeaderboardIntent2 (leaderboardId As String, timeSpan As Int)
Asynchronously loads an Intent to show a leaderboard for a game specified by a leaderboardId. Note that this must be invoked with GPGSGames.StartActivityForResult, so that the identity of the calling package can be established.
ReceivedLeaderboardsIntent event will be raised.
leaderboardId: The ID of the leaderboard to view.
timeSpan: Time span to retrieve data for. Valid values are TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME.
- GetLeaderboardIntent3 (leaderboardId As String, timeSpan As Int, collection As Int)
Asynchronously loads an Intent to show a leaderboard for a game specified by a leaderboardId. Note that this must be invoked with GPGSGames.StartActivityForResult, so that the identity of the calling package can be established.
ReceivedLeaderboardsIntent event will be raised.
leaderboardId: The ID of the leaderboard to view.
timeSpan: Time span to retrieve data for. Valid values are TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME.
collection: The collection to show by default. Valid values are COLLECTION_PUBLIC or COLLECTION_FRIENDS.
- GetLeaderboardsBuffer As GPGSAbstractDataBuffer
Returns the leaderboards buffer.
If the buffer is not loaded yet it will return null. Call LoadLeaderboardMetadata to populate the buffer.
- GetPlayerCenteredScoreFromBuffer (position As Int) As GPGSLeaderboardScore
Get the player centered score object from the buffer.
If the buffer is not loaded yet it will return null. Call LoadPlayerCenteredScores to populate the buffer.
position: Position of the item.
- GetPlayerCenteredScoresBuffer As GPGSAbstractDataBuffer
Returns the player centered score buffer.
If the buffer is not loaded yet it will return null. Call LoadPlayerCenteredScores to populate the buffer.
- GetTopScoreFromBuffer (position As Int) As GPGSLeaderboardScore
Get the top score object from the buffer.
If the buffer is not loaded yet it will return null. Call LoadTopScores to populate the buffer.
position: Position of the item.
- GetTopScoresBuffer As GPGSAbstractDataBuffer
Returns the top score buffer.
If the buffer is not loaded yet it will return null. Call LoadTopScores to populate the buffer.
- IsInitialized As Boolean
- LoadCurrentPlayerLeaderboardScore (leaderboardId As String, span As Int, leaderboardCollection As Int, askConsentIfFailed As Boolean)
Asynchronously loads an annotated LeaderboardScore that represents the signed-in player's score for the leaderboard specified by leaderboardId.
For COLLECTION_FRIENDS, this call will fail if the user has not granted the game access to their friends list.
CurrentPlayerLeaderboardScoreLoaded event will be raised if the task completes successfully.
CurrentPlayerLeaderboardScoreLoadFailed event will be raised if the task failed.
FriendsAccessPermissionGranted event will be raised when user grant/deny from consent screen.
leaderboardId: ID of the leaderboard to load the score from.
span: Time span to retrieve data for. Valid values are TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME.
leaderboardCollection: The leaderboard collection to retrieve scores for. Valid values are either COLLECTION_PUBLIC or COLLECTION_FRIENDS.
askConsentIfFailed: If true, this will show a consent screen asking for permission to access the list.
- LoadLeaderboardMetadata (forceReload As Boolean)
Asynchronously loads a list of leaderboards metadata for this game.
Note: You can't store the returned buffer to any list or array. Use GetLeaderboardFromBuffer to retrieve the items.
Important: Remember to close the buffer by calling Release after you finish working with the buffer data.
AllLeaderboardMetadataLoaded event will be raised.
forceReload: 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.
- LoadLeaderboardMetadata2 (leaderboardId As String, forceReload As Boolean)
Asynchronously loads a leaderboard metadata specified by leaderboardId.
LeaderboardMetadataLoaded event will be raised.
leaderboardId: ID of the leaderboard to load metadata for.
forceReload: 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.
- LoadMoreScores (isTopScoreBuffer As Boolean, buffer As GPGSAbstractDataBuffer, maxResults As Int, pageDirection As Int, askConsentIfFailed As Boolean)
Asynchronously loads an additional page of score data for the given score buffer. A new score buffer will be delivered that replaces the given buffer.
For COLLECTION_FRIENDS, this call will fail if the user has not granted the game access to their friends list.
Note: You can't store the returned buffer to any list or array. Use GetPlayerCenteredScoreFromBuffer / GetTopScoreFromBuffer to retrieve the items.
Important: Remember to close the buffer by calling Release after you finish working with the buffer data.
PlayerCenteredScoresLoaded / TopScoresLoaded event will be raised if the task completes successfully.
PlayerCenteredScoresLoadFailed / TopScoresLoadFailed event will be raised if the task failed.
FriendsAccessPermissionGranted event will be raised when user grant/deny from consent screen.
isTopScoreBuffer: The buffer type. False means PlayerCenteredScoreBuffer.
buffer: The existing buffer that will be expanded. The buffer is allowed to be closed prior to being passed in to this method.
maxResults: The maximum number of scores to fetch per page. Must be between 1 and 25. Note that the number of scores returned here may be greater than this value, depending on how much data is cached on the device.
pageDirection: The direction to expand the buffer. Valid values are PAGE_DIRECTION_NEXT, PAGE_DIRECTION_PREV.
askConsentIfFailed: If true, this will show a consent screen asking for permission to access the list.
- LoadPlayerCenteredScores (leaderboardId As String, span As Int, leaderboardCollection As Int, maxResults As Int, forceReload As Boolean, askConsentIfFailed As Boolean)
Asynchronously loads the player-centered page of scores for the leaderboard specified by leaderboardId. If the player does not have a score on this leaderboard, this call will return the top page instead.
For COLLECTION_FRIENDS, this call will fail if the user has not granted the game access to their friends list.
Note: You can't store the returned buffer to any list or array. Use GetPlayerCenteredScoreFromBuffer to retrieve the items.
Important: Remember to close the buffer by calling Release after you finish working with the buffer data.
PlayerCenteredScoresLoaded event will be raised if the task completes successfully.
PlayerCenteredScoresLoadFailed event will be raised if the task failed.
FriendsAccessPermissionGranted event will be raised when user grant/deny from consent screen.
leaderboardId: ID of the leaderboard.
span: Time span to retrieve data for. Valid values are TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME.
leaderboardCollection: The leaderboard collection to retrieve scores for. Valid values are either COLLECTION_PUBLIC or COLLECTION_FRIENDS.
maxResults: The maximum number of scores to fetch per page. Must be between 1 and 25.
forceReload: 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.
askConsentIfFailed: If true, this will show a consent screen asking for permission to access the list.
- LoadTopScores (leaderboardId As String, span As Int, leaderboardCollection As Int, maxResults As Int, forceReload As Boolean, askConsentIfFailed As Boolean)
Asynchronously loads the top page of scores for the leaderboard specified by leaderboardId.
For COLLECTION_FRIENDS, this call will fail if the user has not granted the game access to their friends list.
Note: You can't store the returned buffer to any list or array. Use GetTopScoreFromBuffer to retrieve the items.
Important: Remember to close the buffer by calling Release after you finish working with the buffer data.
TopScoresLoaded event will be raised if the task completes successfully.
TopScoresLoadFailed event will be raised if the task failed.
FriendsAccessPermissionGranted event will be raised when user grant/deny from consent screen.
leaderboardId: ID of the leaderboard.
span: Time span to retrieve data for. Valid values are TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME.
leaderboardCollection: The leaderboard collection to retrieve scores for. Valid values are either COLLECTION_PUBLIC or COLLECTION_FRIENDS.
maxResults: The maximum number of scores to fetch per page. Must be between 1 and 25.
forceReload: 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.
askConsentIfFailed: If true, this will show a consent screen asking for permission to access the list.
- SubmitScore (leaderboardId As String, score As Long)
Submit a score to a leaderboard for the currently signed-in player. The score is ignored if it is worse (as defined by the leaderboard configuration) than a previously submitted score for the same player.
Use this if you do not need to be notified of the results of submitting the score, though note that the update may not be sent to the server until the next sync.
The meaning of the score value depends on the formatting of the leaderboard established in the developer console. Leaderboards support the following score formats:
Fixed-point: score represents a raw value, and will be formatted based on the number of decimal places configured. A score of 1000 would be formatted as 1000, 100.0, or 10.00 for 0, 1, or 2 decimal places.
Time: score represents an elapsed time in milliseconds. The value will be formatted as an appropriate time value.
Currency: score represents a value in micro units. For example, in USD, a score of 100 would display as $0.0001, while a score of 1000000 would display as $1.00
leaderboardId: The leaderboard to submit the score to.
score: The raw score value.
- SubmitScore2 (leaderboardId As String, score As Long, scoreTag As String)
Submit a score to a leaderboard for the currently signed-in player. The score is ignored if it is worse (as defined by the leaderboard configuration) than a previously submitted score for the same player.
Use this if you do not need to be notified of the results of submitting the score, though note that the update may not be sent to the server until the next sync.
The meaning of the score value depends on the formatting of the leaderboard established in the developer console. Leaderboards support the following score formats:
Fixed-point: score represents a raw value, and will be formatted based on the number of decimal places configured. A score of 1000 would be formatted as 1000, 100.0, or 10.00 for 0, 1, or 2 decimal places.
Time: score represents an elapsed time in milliseconds. The value will be formatted as an appropriate time value.
Currency: score represents a value in micro units. For example, in USD, a score of 100 would display as $0.0001, while a score of 1000000 would display as $1.00
leaderboardId: The leaderboard to submit the score to.
score: The raw score value.
scoreTag: Optional metadata about this score. The value may contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
- SubmitScoreImmediate (leaderboardId As String, score As Long)
Asynchronously submits the score to the leaderboard for the currently signed-in player. The score is ignored if it is worse (as defined by the leaderboard configuration) than a previously submitted score for the same player.
This form of the API will attempt to submit the score to the server immediately within the task, returning a GPGSScoreSubmissionData on success with information about the submission.
The meaning of the score value depends on the formatting of the leaderboard established in the developer console. Leaderboards support the following score formats:
Fixed-point: score represents a raw value, and will be formatted based on the number of decimal places configured. A score of 1000 would be formatted as 1000, 100.0, or 10.00 for 0, 1, or 2 decimal places.
Time: score represents an elapsed time in milliseconds. The value will be formatted as an appropriate time value.
Currency: score represents a value in micro units. For example, in USD, a score of 100 would display as $0.0001, while a score of 1000000 would display as $1.00
ScoreSubmitted event will be raised.
leaderboardId: The leaderboard to submit the score to.
score: The raw score value.
- SubmitScoreImmediate2 (leaderboardId As String, score As Long, scoreTag As String)
Asynchronously submits the score to the leaderboard for the currently signed-in player. The score is ignored if it is worse (as defined by the leaderboard configuration) than a previously submitted score for the same player.
This form of the API will attempt to submit the score to the server immediately within the task, returning a GPGSScoreSubmissionData on success with information about the submission.
The meaning of the score value depends on the formatting of the leaderboard established in the developer console. Leaderboards support the following score formats:
Fixed-point: score represents a raw value, and will be formatted based on the number of decimal places configured. A score of 1000 would be formatted as 1000, 100.0, or 10.00 for 0, 1, or 2 decimal places.
Time: score represents an elapsed time in milliseconds. The value will be formatted as an appropriate time value.
Currency: score represents a value in micro units. For example, in USD, a score of 100 would display as $0.0001, while a score of 1000000 would display as $1.00
ScoreSubmitted event will be raised.
leaderboardId: The leaderboard to submit the score to.
score: The raw score value.
scoreTag: Optional metadata about this score. The value may contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
GPGSNearbyConnections
Events:
- ConnectionBroke (endpointId As String)
- ConnectionError (endpointId As String)
- ConnectionEstablished (success As Boolean, endpointId As String)
- ConnectionRejected (endpointId As String)
- ConnectionRequested (success As Boolean, endpointId As String)
- ConnectionRequestReceived (endpointId As String, endpointName As Sring)
- Disconnected (endpointId As String)
- EndpointFound (endpointId As String, endpointName As Sring, serviceId As Sring)
- EndpointLost (endpointId As String)
- PayloadCancelled (success As Boolean, payloadId As Long)
- PayloadReceived (endpointId As String, payload() As Byte, payloadId As Long)
- PayloadSend (success As Boolean, endpointId As String, payload() As Byte, payloadId As Long)
- RejectedConnectionRequest (success As Boolean, endpointId As String)
- StartAdvertising (success As Boolean)
- StartDiscovery (success As Boolean)
Fields:
- MAX_BYTES_DATA_SIZE As Int
This specifies the maximum allowed size of BYTES Payloads sent via the sendBytesPayload method.
- STRATEGY_P2P_CLUSTER As Object
Peer-to-peer strategy that supports an M-to-N, or cluster-shaped, connection topology.
- STRATEGY_P2P_POINT_TO_POINT As Object
Peer-to-peer strategy that supports a 1-to-1 connection topology.
- STRATEGY_P2P_STAR As Object
Peer-to-peer strategy that supports a 1-to-N, or star-shaped, connection topology.
Functions:
- AcceptConnectionRequest (remoteEndpointId As String)
Accepts a connection to a remote endpoint. This method must be called before Payloads can be exchanged with the remote endpoint.
ConnectionEstablished event will be raised for both case success and failure with result.
PayloadReceived event will be called on receiving a payload after successful connection.
remoteEndpointId: The identifier for the remote endpoint. Should match the value provided in ConnectionRequestReceived event.
- CancelPayload (payloadId As Long)
Cancels a Payload currently in-flight to or from remote endpoint(s).
PayloadCancelled event will be raised for both case success and failure with result.
payloadId: The identifier for the Payload to be canceled.
- DisconnectFromEndpoint (remoteEndpointId As String)
Disconnects from a remote endpoint. Payloads can no longer be sent to or received from the endpoint after this method is called.
remoteEndpointId: The identifier for the remote endpoint to disconnect from.
- Initialize (EventName As String)
Initialize the object.
EventName: The event name prefix.
- RejectConnectionRequest (remoteEndpointId As String)
Rejects a connection to a remote endpoint.
RejectedConnectionRequest event will be raised for both case success and failure with result.
remoteEndpointId: The identifier for the remote endpoint. Should match the value provided in ConnectionRequestReceived event.
- SendConnectionRequest (remoteEndpointId As String, endpointName As String)
Sends a request to connect to a remote endpoint.
ConnectionRequested event will be raised for both case success and failure with result.
ConnectionEstablished event will be raised on successful connection. Means you can now start sending and receiving data.
ConnectionRejected event will be raised if the other user rejects your connection.
ConnectionBroke event will be raised if the connection broke before it was able to be accepted.
ConnectionError event will be raised for other connection issues.
Disconnected event will be raised when disconnected from this endpoint. Means no more data can be sent or received.
remoteEndpointId: The identifier for the remote endpoint to which a connection request will be sent. Should match the value provided in the EndpointFound event.
endpointName: A human readable name for this endpoint, to appear on other devices.
- SendPayload (remoteEndpointId As String, payload As Byte()) As Long
Sends a Payload to a remote endpoint. Payloads can only be sent to remote endpoints once a notice of connection acceptance has been delivered
Byte payloads are the simplest type of payloads. They are suitable for sending simple data like messages or metadata up to a maximum size of MAX_BYTES_DATA_SIZE.
It returns the payload ID that can be used to cancel a payload transfer.
PayloadSend event will be raised for both case success and failure with result.
remoteEndpointId: The identifier for the remote endpoint to which the payload should be sent.
payload: The Payload to be sent.
- StartAdvertising (strategy As Object, endpointName As String)
Starts advertising an endpoint for a local app.
StartAdvertising event will be raised for both case success and failure with result.
ConnectionRequestReceived event will be raised when someone sends you connection request.
ConnectionEstablished event will be raised on successful connection. Means you can now start sending and receiving data.
ConnectionBroke event will be raised if the connection broke before it was able to be accepted.
ConnectionError event will be raised for other connection issues.
Disconnected event will be raised when disconnected from this endpoint. Means no more data can be sent or received.
strategy: Strategy to be used. More info: https://developers.google.com/nearby/connections/strategies
endpointName: A human readable name for this endpoint, to appear on other devices.
- StartDiscovery (strategy As Object)
Starts discovery for remote endpoints with the specified service ID.
StartDiscovery event will be raised for both case success and failure with result.
EndpointFound event will be raised when an endpoint was found. You can request a connection to it.
EndpointLost event will be raised when a previously discovered endpoint has gone away.
strategy: Strategy to be used. More info: https://developers.google.com/nearby/connections/strategies
- StopAdvertising
Stops advertising a local endpoint.
Should be called after calling startAdvertising as soon as the application no longer needs to advertise itself or goes inactive.
Payloads can still be sent to connected endpoints after advertising ends.
- StopAllEndpoints
Disconnects from, and removes all traces of, all connected and/or discovered endpoints.
This call is expected to be preceded by a call to stopAdvertising() or startDiscovery as needed.
After calling stopAllEndpoints(), no further operations with remote endpoints will be possible until
a new call to one of startAdvertising or startDiscovery.
- StopDiscovery
Stops discovery for remote endpoints, after a previous call to startDiscovery,
when the client no longer needs to discover endpoints or goes inactive.
Payloads can still be sent to connected endpoints after discovery ends.
GPGSNetworkInfo
Events:
- NetworkAvailable (networkType As Int)
- NetworkBlockedStatusChanged (networkType As Int, blocked As Boolean)
- NetworkLosing (networkType As Int, maxMsToLive As Int)
- NetworkLost (networkType As Int)
- NoNetworkAvailable
Fields:
- NETWORK_BLUETOOTH As Int
- NETWORK_ETHERNET As Int
- NETWORK_LOWPAN As Int
- NETWORK_MOBILE As Int
- NETWORK_NONE As Int
- NETWORK_VPN As Int
- NETWORK_WIFI As Int
- NETWORK_WIFIAWARE As Int
Functions:
- GetActiveNetwork As Int
Returns the type of the currently active default data network (one of the NETWORK constants).
- GetAllNetworkInfo As Map
Returns a map of all available networks. In the map, key = type of network (one of the NETWORK constants), value = whether it is connected.
- GetConnectedNetwork As Int
Returns the type of the connected network (one of the NETWORK constants).
- getNetworkType (ni As android.net.Network) As Int
- Initialize
Initialize the object.
- IsConnected As Boolean
Returns whether the currently active default data network is connected.
- IsRoaming (NetworkType As Int) As Boolean
Indicates whether the device is currently roaming on the given network.
- RegisterConnectivityChangeListener
Registers a listener to be notified of connectivity changes.
NetworkAvailable Called when the framework connects and has declared a new network ready for use.
NetworkBlockedStatusChanged Called when access to the specified network is blocked or unblocked.
NetworkLosing Called when the network is about to be lost, typically because there are no outstanding requests left for it.
NetworkLost Called when a network disconnects or otherwise no longer satisfies this request or callback.
NoNetworkAvailable Called if no network is found.
- UnregisterConnectivityChangeListener
Stops the notification of connectivity changes.
GPGSPlayGamesService
Events:
- Connected
- ResolutionResult (result As String)
- ServiceUnavailable (userResolveable As Boolean)
- SignInFailed (code As Int, status As String)
- SignOutComplete
Fields:
- RESULT_ACHIEVEMENT_NOT_INCREMENTAL As Int
Indicates that the call to increment achievement failed since the achievement is not an incremental achievement.
- RESULT_ACHIEVEMENT_UNKNOWN As Int
Could not find the achievement, so the operation to update the achievement failed.
- RESULT_ACHIEVEMENT_UNLOCK_FAILURE As Int
An incremental achievement cannot be unlocked directly, so the call to unlock achievement failed.
- RESULT_ACHIEVEMENT_UNLOCKED As Int
Indicates that the incremental achievement was also unlocked when the call was made to increment the achievement.
- RESULT_API_NOT_CONNECTED As Int
The client attempted to call a method from an API that failed to connect. Possible reasons include:
1. The API previously failed to connect with a resolvable error, but the user declined the resolution.
2. The device does not support GmsCore.
3. The specific API cannot connect on this device.
- RESULT_APP_MISCONFIGURED As Int
The developer has misconfigured their application in some way. The logs will contain more data about the error and the appropriate resolution.
- RESULT_CANCELED As Int
The result was canceled either due to client disconnect or
- RESULT_CONNECTION_SUSPENDED_DURING_CALL As Int
The connection was suspended while the call was in-flight. It is possible this failure could be resolved by retrying.
- RESULT_CONSENT_REQUIRED As Int
The player needs to provide consent to allow the request.
- RESULT_DEVELOPER_ERROR As Int
The application is misconfigured. This error is not recoverable and will be treated as fatal. The developer should look at the logs after this to determine more actionable information.
- RESULT_ERROR As Int
The operation failed with no more detailed information.
- RESULT_GAME_NOT_FOUND As Int
The specified game ID was not recognized by the server.
- RESULT_INTERNAL_ERROR As Int
An internal error occurred. Retrying should resolve the problem.
- RESULT_INTERRUPTED As Int
A blocking call was interrupted while waiting and did not run to completion.
- RESULT_INVALID_ACCOUNT As Int
The client attempted to connect to the service with an invalid account name specified.
- RESULT_LICENSE_CHECK_FAILED As Int
The game is not licensed to the user. Further calls will return the same code.
- RESULT_NETWORK_ERROR As Int
A network error occurred. Retrying should resolve the problem.
- RESULT_NETWORK_ERROR_NO_DATA As Int
A network error occurred while attempting to retrieve fresh data, and no data was available locally.
- RESULT_NETWORK_ERROR_OPERATION_FAILED As Int
A network error occurred while attempting to perform an operation that requires network access. The operation may be retried later.
- RESULT_OPERATION_IN_FLIGHT As Int
Trying to start a join/create operation while another is already in flight.
- RESULT_RECONNECT_REQUIRED As Int
Result code sent back to the calling Activity when a reconnect is required.
- RESULT_RECONNECTION_TIMED_OUT As Int
The connection timed-out while attempting to re-connect.
This failure indicates a connection to Google Play services was successfully established, however it was disconnected for some reason (for example, Google Play services crashed), and re-connecting took longer than expected.
Any API calls failed with this status would have been initiated after the connection was disconnected.
- RESULT_RECONNECTION_TIMED_OUT_DURING_UPDATE As Int
The connection timed-out while waiting for Google Play services to update.
This failure indicates a connection to Google Play services was successfully established, however it was disconnected because Google Play services was updated, and the update took far longer than expected.
Any API calls failed with this status would have been initiated after the disconnection for the update.
- RESULT_REMOTE_EXCEPTION As Int
This signifies that an API was able to connect to Google Play services and received an instance, but that when calling an individual method, a RemoteException was thrown.
- RESULT_RESOLUTION_REQUIRED As Int
Completing the operation requires some form of resolution.
A resolution will be available to be started with StartResolutionForResult().
If the result returned is OK, then further attempts should either complete or continue on to the next issue that needs to be resolved.
- RESULT_SIGN_IN_REQUIRED As Int
The client attempted to connect to the service but the user is not signed in.
The client may choose to continue without using the API. Alternately, if HasResolution() returns true the client may call StartResolutionForResult() to prompt the user to sign in.
If the result returned is OK, then further attempts should either complete or continue on to the next issue that needs to be resolved.
- RESULT_SNAPSHOT_COMMIT_FAILED As Int
The attempt to commit the snapshot change failed. See the device logs for more details.
- RESULT_SNAPSHOT_CONFLICT_MISSING As Int
The conflict that was being resolved doesn't exist. This could occur if another device resolved this conflict first, or if an inappropriate conflict ID was provided to resolveConflict.
- RESULT_SNAPSHOT_CONTENTS_UNAVAILABLE As Int
An error occurred while attempting to open the contents of the snapshot. See the device logs for more details.
- RESULT_SNAPSHOT_CREATION_FAILED As Int
The attempt to create a snapshot failed. See the device logs for more details.
- RESULT_SNAPSHOT_FOLDER_UNAVAILABLE As Int
The root folder for snapshots could not be found or created. See the device logs for more details on the failure.
- RESULT_SNAPSHOT_NOT_FOUND As Int
The specified snapshot does not exist on the server.
- RESULT_SUCCESS As Int
The operation was successful.
- RESULT_SUCCESS_CACHE As Int
The operation was successful, but was used the device's cache. If this is a write, the data will be written when the device is online; errors will be written to the logs. If this is a read, the data was read from a device cache and may be stale.
- RESULT_TIMEOUT As Int
Timed out while awaiting the result.
- RESULT_VIDEO_ALREADY_CAPTURING As Int
Request could not complete because we were already capturing.
- RESULT_VIDEO_NOT_ACTIVE As Int
Request could not complete because there is no active screencast capture session.
- RESULT_VIDEO_OUT_OF_DISK_SPACE As Int
Request could not complete because the device is out of disk space.
- RESULT_VIDEO_PERMISSION_ERROR As Int
Request could not complete due to permission problems.
- RESULT_VIDEO_STORAGE_ERROR As Int
Request could not complete due to a storage I/O error.
- RESULT_VIDEO_UNEXPECTED_CAPTURE_ERROR As Int
Request could not complete because something unrecoverable happened in the capture service.
- RESULT_VIDEO_UNSUPPORTED As Int
Request could not complete because the request or its options are not supported.
Functions:
- GetLastSignedInAccount As GPGSUserAccount
Gets the last account that the user signed in with.
- GetStatusCodeString (statusCode As Int) As String
Get untranslated debug (not user-friendly!) string based on the current status code.
- HasResolution As Boolean
Check if there is any pending resolution
- Initialize (eventName As String)
Initialize the object.
eventName: The event name prefix. This will be used for all other classes.
- IsSignedIn As Boolean
Check if the user is signed in or not.
- ManualSignIn (accountName As String, useSnapshotAPI As Boolean)
Performing interactive sign-in. Setup OAuth 2.0 client before using this method.
The Google Sign-In API will display a user interface that prompts the player to enter their credentials to sign in.
This approach simplifies your app development, since the sign-in activity handles scenarios such as needing to update Google Play services or showing consent prompts, on your app’s behalf.
Connected event will be raised if the task completes successfully.
SignInFailed event will be raised if the task failed.
accountName: Account name on the device that should be used. If this is empty, the client will use the current default account for Google Play services for this application.
useSnapshotAPI: Whether you want to use snapshot api or not.
- ShowServiceUnavailableDialog
Show service unavailable dialog if ServiceUnavailable event returns true on library initialization (means its user resolvable error)
- SignOut
Sign out the current user.
- SilentSignIn (accountName As String, useSnapshotAPI As Boolean)
Performing silent sign-in
You can call SilentSignIn() to retrieve the currently signed-in player’s account, and try to sign players in without
displaying a user interface if they have successfully signed in to your app on a different device.
Connected event will be raised if the task completes successfully.
SignInFailed event will be raised if the task failed.
accountName: Account name on the device that should be used. If this is empty, the client will use the current default account for Google Play services for this application.
useSnapshotAPI: Whether you want to use snapshot api or not.
- StartResolutionForResult
Resolve any pending resolution
GPGSPlayer
Events:
- PlayerBannerImageLoaded (uri As String, isBitmap As Boolean)
- PlayerProfileImageLoaded (uri As String, isBitmap As Boolean)
Fields:
- CURRENT_XP_UNKNOWN As Long
Constant indicating that the current XP total for a player is not known.
- FRIEND_LIST_VISIBILITY_FEATURE_UNAVAILABLE As Int
onstant indicating that the friends list is currently unavailable for the game. You cannot request access at this time, either because the user has permanently declined or the friends feature is not available to them. In this state, any attempts to request access to the friends list will be unsuccessful.
- FRIEND_LIST_VISIBILITY_REQUEST_REQUIRED As Int
Constant indicating that the friends list is not visible to the game, but the game can ask for access.
- FRIEND_LIST_VISIBILITY_UNKNOWN As Int
Constant indicating that currently it's unknown if the friends list is visible to the game, or whether the game can ask for access from the user.
- FRIEND_LIST_VISIBILITY_VISIBLE As Int
Constant indicating that the friends list is currently visible to the game.
- FRIEND_STATUS_FRIEND As Int
Constant indicating that the currently signed-in player and this player are friends.
- FRIEND_STATUS_NO_RELATIONSHIP As Int
Constant indicating that the currently signed-in player is not a friend of this player, and there are no pending invitations between them.
- FRIEND_STATUS_UNKNOWN As Int
Constant indicating that the currently signed-in player's friend status with this player is unknown.
- TIMESTAMP_UNKNOWN As Long
Constant indicating that a timestamp for a player is not known.
Functions:
- GetBannerImageUri (landscape As Boolean) As String
Retrieves the URI for loading this player's banner image. Returns null if the player has no banner image.
landscape: If true it will load landscape banner else portrait banner.
- GetDisplayName As String
Retrieves the display name for this player.
- GetFriendsListVisibilityStatus As Int
Retrieves if the user has shared the friends list with the game. Only available for the signed-in user. The method will return FRIEND_LIST_VISIBILITY_UNKNOWN for other players.
- GetLevelInfo As GPGSPlayerLevelInfo
Retrieves the player level associated information if any exists. If no level information exists for this player, this method will return null.
- GetPlayerFriendStatus As Int
Retrieves this player's friend status relative to the currently signed-in player. If no relationship information exists for this player, this method will return FRIEND_STATUS_UNKNOWN.
- GetPlayerId As String
Retrieves the ID of this player.
- GetProfileImageUri (hiRes As Boolean) As String
Retrieves the URI for loading this player's profile image. Returns null if the player has no profile image.
hiRes: If true will load HD image else icon-size image.
- GetRetrievedTimestamp As Long
Retrieves the timestamp at which this player record was last updated locally.
- GetTitle As String
Retrieves the title of the player. This is based on the player's gameplay activity in apps using Google Play Games services. Note that not all players have titles, and that a player's title may change over time.
- HasHiResImage As Boolean
Indicates whether this player has a hi-res profile image to display.
- HasIconImage As Boolean
Indicates whether this player has an icon-size profile image to display.
- IsInitialized As Boolean
- SetBannerImage (landscape As Boolean, IV As ImageView)
Set player's banner image to the give image view.
PlayerBannerImageLoaded event will be raised.
landscape: If true it will load landscape banner else portrait banner.
IV: ImageView on which you want to load the image.
- SetProfileImage (hiRes As Boolean, IV As ImageView)
Set player's profile image to the give image view.
PlayerProfileImageLoaded event will be raised.
hiRes: If true will load HD image else icon-size image.
IV: ImageView on which you want to load the image.
GPGSPlayerLevel
Functions:
- Equals (obj As Object) As Boolean
- GetLevelNumber As Int
Returns the number for this level, e.g. "level 10".
For a player to be considered as being of this level, the value given by GPGSPlayerLevelInfo.GetCurrentXpTotal must fall in the range getMinXp(), getMaxXp().
- GetMaxXP As Long
The maximum XP value represented by this level, exclusive.
- GetMinXP As Long
The minimum XP value needed to attain this level, inclusive.
- IsInitialized As Boolean
GPGSPlayerLevelInfo
Functions:
- Equals (obj As Object) As Boolean
- GetCurrentLevel As GPGSPlayerLevel
Getter for the player's current level object. This object will be the same as the one returned from getNextLevel() if the player reached the maximum level.
- GetCurrentXpTotal As Long
Returns the player's current XP value.
- GetLastLevelUpTimestamp As Long
Returns the timestamp of the player's last level-up.
- GetNextLevel As GPGSPlayerLevel
Getter for the player's next level object. This object will be the same as the one returned from getCurrentLevel() if the player reached the maximum level.
- IsInitialized As Boolean
- IsMaxLevel As Boolean
Returns true if the player reached the maximum level (getCurrentLevel() is the same as getNextLevel().
GPGSPlayerStats
Fields:
- UNSET_VALUE As Float
The default value for each field when there isn't enough data to calculate. Please check the value against this before using it.
Functions:
- GetAverageSessionLength As Float
The average session length of the player in minutes. Session length is determined by the time that a player is signed in to Google Play Games services.
- GetDaysSinceLastPlayed As Int
The approximate number of days since the player last played.
- GetNumberOfPurchases As Int
The approximate number of in-app purchases for the player.
- GetNumberOfSessions As Int
The approximate number of sessions of the player. Sessions are determined by the number of times that a player signs in to Google Play Games services.
- GetSessionPercentile As Float
The approximation of sessions percentile for the player. This value indicates how many sessions the current player has played in comparison to the rest of this game's player base. Higher numbers indicate that this player has played more sessions.
- GetSpendPercentile As Float
The approximate spend percentile of the player. This value indicates how much the current player has spent in comparison to the rest of this game's player base. Higher numbers indicate that this player has spent more.
- IsInitialized As Boolean
GPGSPlayerStatsClient
Events:
- PlayerStatsLoaded (stats As GPGSPlayerStats, statusCode As Int)
Functions:
- IsInitialized As Boolean
- LoadPlayerStats (forceReload As Boolean)
Asynchronously loads an annotated PlayerStats for the currently signed-in player and game into a single result.
PlayerStatsLoaded event will be raised.
forceReload:
GPGSPlayersClient
Events:
- FriendsAccessPermissionGranted (granted As Boolean)
- FriendsLoaded (count As Int)
- FriendsLoadFailed (showingConsent As Boolean, statusCode As Int)
- PlayerLoaded (player As GPGSPlayer, statusCode As Int)
- ReceivedCompareProfileIntent (intent As Intent, statusCode As Int)
- ReceivedCurrentPlayerData (currentPlayer As GPGSPlayer, statusCode As Int)
- ReceivedCurrentPlayerID (currentPlayerID As String, statusCode As Int)
- ReceivedPlayerSearchIntent (intent As Intent, statusCode As Int)
Fields:
- EXTRA_PLAYER_SEARCH_RESULTS As String
Used by the Player Search UI to return a list of parceled Player objects.
Functions:
- GetCompareProfileIntent (otherPlayerId As String)
Asynchronously loads an Intent that will display a screen where the user can see a comparison of their own profile against another player's profile.
Note that the Intent returned from the Task must be invoked with GPGSGames.StartActivityForResult, so that the identity of the calling package can be established.
ReceivedCompareProfileIntent event will be raised.
otherPlayerId: The player ID of the player to compare with.
- GetCompareProfileIntent2 (player As GPGSPlayer)
Asynchronously loads an Intent that will display a screen where the user can see a comparison of their own profile against another player's profile.
Note that the Intent returned from the Task must be invoked with GPGSGames.StartActivityForResult, so that the identity of the calling package can be established.
ReceivedCompareProfileIntent event will be raised.
player: The player object of the player to compare with.
- GetCompareProfileIntentWithAlternativeNameHints (otherPlayerId As String, otherPlayerInGameName As String, currentPlayerInGameName As String)
Asynchronously loads an Intent that will display a screen where the user can see a comparison of their own profile against another player's profile.
Note that the Intent returned from the Task must be invoked with GPGSGames.StartActivityForResult, so that the identity of the calling package can be established.
Note that PGS gamer tags should not be provided as the "alternative" name. This form of #getCompareProfileIntent should be used when the game has its own player names separate
from the Play Games Services gamer tag. These names will be used in the profile display and only sent to the server if the player initiates a friend invitation to the profile being viewed,
so that the sender and recipient have context relevant to their game experience.
ReceivedCompareProfileIntent event will be raised.
otherPlayerId: The player ID of the player to compare with.
otherPlayerInGameName: The game's own display name of the player referred to by otherPlayerId.
currentPlayerInGameName: The game's own display name of the current player.
- GetCurrentPlayer (forceReload As Boolean)
Asynchronously loads the current signed-in Player, if available.
ReceivedCurrentPlayerData event will be raised.
forceReload: 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.
- GetCurrentPlayerId
Asynchronously loads the current signed-in player ID, if available.
ReceivedCurrentPlayerID event will be raised.
- GetFriendFromBuffer (position As Int) As GPGSPlayer
Get the player object of the friend from the buffer.
If the buffer is not loaded yet it will return null. Call LoadFriends to populate the buffer.
position: Position of the item.
- GetFriendsBuffer As GPGSAbstractDataBuffer
Returns the friends buffer.
If the buffer is not loaded yet it will return null. Call LoadFriends to populate the buffer.
- GetPlayerSearchIntent
Asynchronously loads an Intent that will display a screen where the user can search for players.
Note that this must be invoked with GPGSGames.StartActivityForResult, so that the identity of the calling package can be established.
If the user canceled, the result will be RESULT_CANCELED. If the user selected any players from the search results list, the result will be RESULT_OK, and the data intent will contain a list of parceled Player objects in EXTRA_PLAYER_SEARCH_RESULTS
Note that the current Player Search UI only allows a single selection, so the returned list of parceled Player objects will currently contain at most one Player.
ReceivedPlayerSearchIntent event will be raised.
- IsInitialized As Boolean
- LoadFriends (pageSize As Int, forceReload As Boolean, askConsentIfFailed As Boolean)
Asynchronously loads an annotated PlayerBuffer that represents friends the user has.
This call will fail if the user has not granted the game access to their friends list.
Note: You can't store the returned buffer to any list or array. Use GetFriendFromBuffer to retrieve the items.
Important: Remember to close the buffer by calling Release after you finish working with the buffer data.
FriendsLoaded event will be raised if the task completes successfully.
FriendsLoadFailed event will be raised if the task failed.
FriendsAccessPermissionGranted event will be raised when user grant/deny from consent screen.
pageSize: The number of entries to request for this initial page. Note that if cached data already exists, the returned buffer may contain more than this size, but it is guaranteed to contain at least this many if the collection contains enough records.
forceReload: 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.
askConsentIfFailed: If true, this will show a consent screen asking for permission to access the list.
- LoadMoreFriends (pageSize As Int, askConsentIfFailed As Boolean)
Asynchronously loads an annotated PlayerBuffer that represents friends the user has.
The PlayerBuffer will contain an extra page of results.
This call will fail if the user has not granted the game access to their friends list.
Note: You can't store the returned buffer to any list or array. Use GetFriendFromBuffer to retrieve the items.
Important: Remember to close the buffer by calling Release after you finish working with the buffer data.
FriendsLoaded event will be raised if the task completes successfully.
FriendsLoadFailed event will be raised if the task failed.
FriendsAccessPermissionGranted event will be raised when user grant/deny from consent screen.
pageSize: The number of additional entries to request.
askConsentIfFailed: If true, this will show a consent screen asking for permission to access the list.
- LoadPlayer (playerId As String, forceReload As Boolean)
Asynchronously loads an annotated Player profile specified by playerId.
PlayerLoaded event will be raised.
playerId: The player ID to get full profile data for.
forceReload: 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.
GPGSScoreSubmissionData
Fields:
- TIME_SPAN_ALL_TIME As Int
Scores are never reset.
- TIME_SPAN_DAILY As Int
Scores are reset every day. The reset occurs at 11:59PM PST.
- TIME_SPAN_WEEKLY As Int
Scores are reset once per week. The reset occurs at 11:59PM PST on Sunday.
Functions:
- GetLeaderboardId As String
Retrieves the ID of the leaderboard the score was submitted to.
- GetPlayerId As String
Retrieves the ID of the player the score was submitted for.
- GetScoreResult (timeSpan As Int) As GPGSScoreSubmissionDataResult
Retrieves the ScoreSubmissionData.Result object for the given time span, if any.
timeSpan: Time span to retrieve result for. Valid values are TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME.
- IsInitialized As Boolean
- ToString As String
GPGSScoreSubmissionDataResult
Functions:
- FormattedScore As String
String containing the score data in a display-appropriate format.
- IsInitialized As Boolean
- NewBest As Boolean
Boolean indicating whether or not this score was the player's new best score for this time span.
- RawScore As Long
The raw score value of this score result.
- ScoreTag As String
The score tag associated with this result, if any.
- ToString As String
GPGSSnapshot
Functions:
- GetMetadata As GPGSSnapshotMetadata
Retrieves the metadata for this snapshot.
- GetSnapshotContents As GPGSSnapshotContents
Retrieve the GPGSSnapshotContents associated with this snapshot.
This object can be used to update the data of a snapshot.
Note that this will return null if this snapshot was not obtained via GPGSSnapshotsClient.open method.
- IsInitialized As Boolean
GPGSSnapshotContents
Functions:
- IsClosed As Boolean
Returns whether this snapshot contents has been closed.
- IsInitialized As Boolean
- ModifyBytes (dstOffset As Int, content As Byte(), srcOffset As Int, count As Int) As Boolean
Write the specified data into the snapshot. The contents of the snapshot will be replaced with the data provided in content. The data will be persisted on disk, but is not uploaded to the server until the snapshot is committed via commitAndClose.
Note that this form of the API does not necessarily overwrite the entire contents of the file. If you are writing less data than was previously stored in the snapshot, the excess data will remain. Use writeBytes(byte[]) to fully overwrite the file.
If the snapshot was not opened via GPGSSnapshotsClient.open, or if the contents have already been committed via GPGSSnapshotsClient.commitAndClose, this method will throw an exception.
Returns whether or not the data was successfully written to disk.
dstOffset: Position in the snapshot file to start writing data to. 0 indicates the head of the file.
content: The data to write.
srcOffset: Position in content to start writing from.
count: Number of bytes from content to write to this snapshot.
- ReadFully As Byte()
Reads bytes of the snapshot contents.
If the snapshot was not opened via GPGSSnapshotsClient.open, or if the contents have already been committed via commitAndClose, this method will throw an exception.
- WriteBytes (content As Byte()) As Boolean
Write the specified data into the snapshot. The contents of the snapshot will be replaced with the data provided in content. The data will be persisted on disk, but is not uploaded to the server until the snapshot is committed via GPGSSnapshotsClient.commitAndClose.
Note that this form of the API will fully overwrite the contents of the file. No previous data will be retained. Use modifyBytes to overwrite parts of the file.
content: The data to write.
GPGSSnapshotMetadata
Events:
- SnapshotCoverImageLoaded (uri As String, isBitmap As Boolean)
Fields:
- PLAYED_TIME_UNKNOWN As Long
Constant indicating that the played time of a snapshot is unknown.
- PROGRESS_VALUE_UNKNOWN As Long
Constant indicating that the progress value of a snapshot is unknown.
Functions:
- GetCoverImageAspectRatio As Float
Retrieves the aspect ratio of the cover image for this snapshot, if any. This is the ratio of width to height, so a value > 1.0f indicates a landscape image while a value < 1.0f indicates a portrait image. If the snapshot has no cover image, this will return 0.0f.
- GetCoverImageUri As String
Retrieves an image URI that can be used to load the snapshot's cover image. Returns null if the snapshot has no cover image.
- GetDescription As String
Retrieves the description of this snapshot.
- GetDeviceName As String
Retrieves the name of the device that wrote this snapshot, if known.
- GetGame As GPGSGame
Retrieves the game associated with this snapshot.
- GetLastModifiedTimestamp As Long
Retrieves the last time this snapshot was modified, in millis since epoch.
- GetOwner As GPGSPlayer
Retrieves the player that owns this snapshot.
- GetPlayedTime As Long
Retrieves the played time of this snapshot in milliseconds. This value is specified during the update operation. If not known, returns PLAYED_TIME_UNKNOWN.
- GetProgressValue As Long
Retrieves the progress value for this snapshot. Can be used to provide automatic conflict resolution (see RESOLUTION_POLICY_HIGHEST_PROGRESS). If not known, returns PROGRESS_VALUE_UNKNOWN.
- GetSnapshotId As String
Retrieves the ID of this snapshot.
- GetUniqueName As String
Retrieves the unique identifier of this snapshot. This name should be unique within the scope of the application.
- HasChangePending As Boolean
Indicates whether or not this snapshot has any changes pending that have not been uploaded to the server. Once all changes have been flushed to the server, this will return false.
- IsInitialized As Boolean
- SetCoverImage (IV As ImageView)
Set the snapshot's cover image to the give image view.
SnapshotCoverImageLoaded event will be raised.
IV: ImageView on which you want to load the icon.
GPGSSnapshotMetadataChange
Fields:
- EMPTY_CHANGE As GPGSSnapshotMetadataChange
Sentinel object to use to commit a change without modifying the metadata.
- PLAYED_TIME_UNKNOWN As Long
Constant indicating that the played time of a snapshot is unknown.
- PROGRESS_VALUE_UNKNOWN As Long
Constant indicating that the progress value of a snapshot is unknown.
Functions:
- Builder (cover As Bitmap, description As String, playedTimeMillis As Long, progressValue As Long) As GPGSSnapshotMetadataChange
Build the object with the changes that need to be applied to a snapshot.
cover: The bitmap to use for the snapshot's cover image. Null is not needed.
description: The description of the snapshot.
playedTimeMillis: The played time of the snapshot in milliseconds. Can be set to PLAYED_TIME_UNKNOWN if unknown.
progressValue: The progress value of the snapshot. Can be set to PROGRESS_VALUE_UNKNOWN if unknown.
- GetCoverImage As Bitmap
The new cover image to set for the snapshot.
- GetDescription As String
The new description to set for the snapshot.
- GetPlayedTimeMillis As Long
The new played time to set for the snapshot.
- GetProgressValue As Long
The new progress value to set for the snapshot.
- IsInitialized As Boolean
GPGSSnapshotsClient
Events:
- SelectSnapshotIntentReveived (intent As Intent, statusCode As Int)
- SnapshotCommittedAndClosed (metadata As GPGSSnapshotMetadata, statusCode As Int)
- SnapshotConflictOccurred (conflictingWith As GPGSSnapshot, conflictId As String)
- SnapshotContentUnavailable
- SnapshotDeleted (snapshotID As String, statusCode As Int)
- SnapshotDiscardedAndClosed (statusCode As Int)
- SnapshotMaxCoverImageSizeReveived (size As Int, statusCode As Int)
- SnapshotMetadataLoaded (count As Int, statusCode As Int)
- SnapshotOpened (snapshot As GPGSSnapshot)
Fields:
- DISPLAY_LIMIT_NONE As Int
Constant indicating that the UI should not cap the number of displayed snapshots.
- EXTRA_SNAPSHOT_METADATA As String
Intent extra used to pass a SnapshotMetadata.
- EXTRA_SNAPSHOT_NEW As String
Intent extra used to indicate the user wants to create a new snapshot.
- RESOLUTION_POLICY_HIGHEST_PROGRESS As Int
In the case of a conflict, the snapshot with the highest progress value will be used. In the case of a tie, the last known good snapshot will be chosen instead. This policy is a good choice if your game uses the progress value of the snapshot to determine the best saved game. Note that you must use setProgressValue(long) when saving games for this policy to be meaningful.
- RESOLUTION_POLICY_LAST_KNOWN_GOOD As Int
In the case of a conflict, the last known good version of this snapshot will be used. This corresponds to the data that would be returned from getSnapshot() in a custom merge.This policy is a reasonable choice if your game requires stability from the snapshot data. This policy ensures that only writes which are not contested are seen by the player, which guarantees that all clients converge.
- RESOLUTION_POLICY_LONGEST_PLAYTIME As Int
In the case of a conflict, the snapshot with the longest played time will be used. In the case of a tie, the last known good snapshot will be chosen instead. This policy is a good choice if the length of play time is a reasonable proxy for the "best" save game. Note that you must use setPlayedTimeMillis(long) when saving games for this policy to be meaningful.
- RESOLUTION_POLICY_MANUAL As Int
In the case of a conflict, the result will be returned to the app for resolution. No automatic resolution will be performed. This policy ensures that no user changes to the state of the save game will ever be lost.
- RESOLUTION_POLICY_MOST_RECENTLY_MODIFIED As Int
In the case of a conflict, the most recently modified version of this snapshot will be used. This corresponds to the data that would be returned from getConflictingSnapshot() in a custom merge. This policy is a reasonable choice if your game can tolerate players on multiple devices clobbering their own changes. Because this policy blindly chooses the most recent data, it is possible that a player's changes may get lost.
Functions:
- CommitAndClose (snapshot As GPGSSnapshot, metadataChange As GPGSSnapshotMetadataChange)
Asynchronously commits any modifications in GPGSSnapshotMetadataChange made to the GPGSSnapshot and loads a GPGSSnapshotMetadata. The Task 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 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 by getMaxDataSize().
SnapshotCommittedAndClosed event will be raised.
snapshot: The snapshot to commit the data for.
metadataChange: The set of changes to apply to the metadata for the snapshot. Use EMPTY_CHANGE to preserve the existing metadata.
- Delete (metadata As GPGSSnapshotMetadata)
Asynchronously deletes the specified by GPGSSnapshotMetadata snapshot and loads the deleted snapshot ID. This will delete the data of the snapshot locally and on the server.
SnapshotDeleted event will be raised.
metadata: The metadata of the snapshot to delete.
- DiscardAndClose (snapshot As GPGSSnapshot)
Asynchronously discards the contents of the Snapshot and closes it. This will discard all changes made to the file, and close the snapshot to future changes until it is re-opened. The file will not be modified on the server.
This method fails when called with a snapshot that was not opened or has already been committed/discarded.
SnapshotDiscardedAndClosed event will be raised.
snapshot: The snapshot to discard the data for.
- GetMaxCoverImageSize
Asynchronously loads the maximum data size per snapshot cover image in bytes. Guaranteed to be at least 800 KB. May increase in the future.
SnapshotMaxCoverImageSizeReveived event will be raised.
- GetMaxDataSize
Asynchronously loads the maximum data size per snapshot in bytes. Guaranteed to be at least 3 MB. May increase in the future.
SnapshotMaxDataSizeReveived event will be raised.
- GetSelectSnapshotIntent (title As String, allowAddButton As Boolean, allowDelete As Boolean, maxSnapshots As Int)
Asynchronously loads an Intent that will let the user select a snapshot. Note that the Intent returned from the Task must be invoked with GPGSGames.StartActivityForResult, so that the identity of the calling package can be established.
If the user canceled without selecting a snapshot, the result will be RESULT_CANCELED. If the user selected a snapshot from the list, the result will be RESULT_OK and the data intent will contain the selected Snapshot as a parcelable object in EXTRA_SNAPSHOT_METADATA. If the user pressed the add button, the result will be RESULT_OK and the data intent will contain a true boolean value in EXTRA_SNAPSHOT_NEW.
Note that if you have modified an open snapshot, the changes will not appear in this UI until you call commitAndClose on the snapshot.
SelectSnapshotIntentReveived event will be raised.
title: The title to display in the action bar of the returned Activity.
allowAddButton: Whether or not to display a "create new snapshot" option in the selection UI.
allowDelete: Whether or not to provide a delete overflow menu option for each snapshot in the selection UI.
maxSnapshots: The maximum number of snapshots to display in the UI. Use DISPLAY_LIMIT_NONE to display all snapshots.
- GetSnapshotFromBuffer (position As Int) As GPGSSnapshot
Get the snapshot object from the buffer.
If the buffer is not loaded yet it will return null. Call Load to populate the buffer.
position: Position of the item.
- GetSnapshotMetadataFromIntentExtra (Intent As Intent) As GPGSSnapshotMetadata
Retrieves the GPGSSnapshotMetadata of a snapshot from the given intent.
Intent: The intent from which you want to fetch the snapshot metadata.
- GetSnapshotsBuffer As GPGSAbstractDataBuffer
Returns the snapshots buffer.
If the buffer is not loaded yet it will return null. Call Load to populate the buffer.
- IsInitialized As Boolean
- Load (forceReload As Boolean)
Asynchronously loads a list of GPGSSnapshotMetadata that represents the snapshot data for the currently signed-in player.
Note: You can't store the returned buffer to any list or array. Use GetSnapshotFromBuffer to retrieve the items.
Important: Remember to close the buffer by calling Release after you finish working with the buffer data.
SnapshotMetadataLoaded event will be raised.
forceReload: 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.
- Open (metadata As GPGSSnapshotMetadata)
Asynchronously opens a snapshot with the given SnapshotMetadata (usually returned from Load().
To succeed, the snapshot must exist; i.e. this call will fail if the snapshot was deleted between the load and open calls.
This will open the snapshot using RESOLUTION_POLICY_MANUAL as a conflict policy. If a conflict occurred, an event will raise, and the conflict will need to be resolved using resolveConflict to continue with opening the snapshot.
If the snapshot's contents are unavailable, the Task will fail.
SnapshotOpened event will be raised if the task completes successfully.
SnapshotContentUnavailable event will be raised if the task failed.
SnapshotConflictOccurred event will be raised if a conflict occurred. The conflict will need to be resolved using resolveConflict to continue with opening the snapshot.
metadata: The metadata of the existing snapshot to load.
- OpenWithConflictPolicy (metadata As GPGSSnapshotMetadata, conflictPolicy As Int)
Asynchronously opens a snapshot with the given SnapshotMetadata (usually returned from Load().
To succeed, the snapshot must exist; i.e. this call will fail if the snapshot was deleted between the load and open calls.
If a conflict occurred the conflict will need to be resolved using resolveConflict to continue with opening the snapshot.
If the snapshot's contents are unavailable, the Task will fail.
SnapshotOpened event will be raised if the task completes successfully.
SnapshotContentUnavailable event will be raised if the task failed.
SnapshotConflictOccurred event will be raised if a conflict occurred. The conflict will need to be resolved using resolveConflict to continue with opening the snapshot.
metadata: The metadata of the existing snapshot to load.
conflictPolicy: The conflict resolution policy to use for this snapshot.
- OpenWithName (fileName As String, createIfNotFound As Boolean)
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.
This will open the snapshot using RESOLUTION_POLICY_MANUAL as a conflict policy. If a conflict occurred the conflict will need to be resolved using resolveConflict to continue with opening the snapshot.
If the snapshot's contents are unavailable, the Task will fail.
SnapshotOpened event will be raised if the task completes successfully.
SnapshotContentUnavailable event will be raised if the task failed.
SnapshotConflictOccurred event will be raised if a conflict occurred. The conflict will need to be resolved using resolveConflict to continue with opening the snapshot.
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 "~").
createIfNotFound: If true, the snapshot will be created if one cannot be found.
- OpenWithNameAndConflictPolicy (fileName As String, createIfNotFound As Boolean, conflictPolicy As Int)
Asynchronously opens a snapshot with the given SnapshotMetadata (usually returned from Load().
To succeed, the snapshot must exist; i.e. this call will fail if the snapshot was deleted between the load and open calls.
If a conflict occurred the conflict will need to be resolved using resolveConflict to continue with opening the snapshot.
If the snapshot's contents are unavailable, the Task will fail.
SnapshotOpened event will be raised if the task completes successfully.
SnapshotContentUnavailable event will be raised if the task failed.
SnapshotConflictOccurred event will be raised if a conflict occurred. The conflict will need to be resolved using resolveConflict to continue with opening the snapshot.
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 "~").
createIfNotFound: If true, the snapshot will be created if one cannot be found.
conflictPolicy: The conflict resolution policy to use for this snapshot.
- ResolveConflict (conflictId As String, snapshot As GPGSSnapshot)
Asynchronously resolves a conflict using the provided data. This will replace the data on the server with the specified GPGSSnapshotMetadataChange and GPGSSnapshotContents. Note that it is possible for this operation to result in a conflict itself, in which case resolution should be repeated.
Values which are not included in the metadata change will be resolved to the version currently on the server.
If a conflict occurred the conflict will need to be resolved again using resolveConflict to continue with opening the snapshot.
Note that the total size of the contents of snapshot may not exceed the size provided by getMaxDataSize().
This method fails when called with a snapshot that was not opened or has already been committed/discarded.
If the resolved snapshot's contents are unavailable, the task will fail.
SnapshotOpened event will be raised if the task completes successfully.
SnapshotContentUnavailable event will be raised if the task failed.
SnapshotConflictOccurred event will be raised if a conflict occurred. The conflict will need to be resolved using resolveConflict to continue with opening the snapshot.
conflictId: The ID of the conflict to resolve.
snapshot: The snapshot to use to resolve the conflict.
- ResolveConflictWithData (conflictId As String, snapshotId As String, metadataChange As GPGSSnapshotMetadataChange, snapshotContents As GPGSSnapshotContents)
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.
If a conflict occurred the conflict will need to be resolved again using resolveConflict to continue with opening the snapshot.
Note that the total size of the contents of snapshot may not exceed the size provided by getMaxDataSize().
This method fails when called with a snapshot that was not opened or has already been committed/discarded.
If the resolved snapshot's contents are unavailable, the task will fail.
SnapshotOpened event will be raised if the task completes successfully.
SnapshotContentUnavailable event will be raised if the task failed.
SnapshotConflictOccurred event will be raised if a conflict occurred. The conflict will need to be resolved using resolveConflict to continue with opening the snapshot.
conflictId: The ID of the conflict to resolve.
snapshotId: The ID of the snapshot to resolve the conflict for.
metadataChange: The set of changes to apply to the metadata for the snapshot.
snapshotContents: The SnapshotContents to replace the snapshot data with.
GPGSUserAccount
Functions:
- GetDisplayName As String
Returns the display name of the signed in user
- GetFamilyName As String
Returns the family name of the signed in user
- GetGivenName As String
Returns the given name of the signed in user
- GetId As String
Returns the unique ID for the Google account
- GetPhotoUrl As String
Returns the photo url of the signed in user if the user has a profile picture
- IsInitialized As Boolean
GPGSVideoCapabilities
Fields:
- CAPTURE_MODE_FILE As Int
Capture device audio and video to a local file.
- CAPTURE_MODE_STREAM As Int
Capture device audio and video, and stream it live.
- QUALITY_LEVEL_FULLHD As Int
Full HD quality: 2160P resolution and high bit rate, e.g. 10-12Mbps.
- QUALITY_LEVEL_HD As Int
HD quality: DVD HD resolution (i.e. 720p) and a medium bit rate (e.g. 3-4Mbps).
- QUALITY_LEVEL_SD As Int
SD quality: Standard def resolution (e.g. 480p) and a low bit rate (e.g. 1-2Mbps).
- QUALITY_LEVEL_XHD As Int
Extreme HD quality: BluRay HD resolution (i.e. 1080p) and a high bit rate (e.g. 6-8Mbps).
Functions:
- Equals (obj As Object) As Boolean
- GetSupportedCaptureModes As Boolean()
Returns a collection of all supported capture modes.
- GetSupportedQualityLevels As Boolean()
Returns a collection of all supported capture qualities.
- IsCameraSupported As Boolean
Returns whether the device has a front-facing camera and we can use it.
- IsFullySupported (captureMode As Int, qualityLevel As Int) As Boolean
Checks if the capture mode and quality level are support, and camera, mic, and storage write.
captureMode: One of these values: CAPTURE_MODE_FILE or CAPTURE_MODE_STREAM.
qualityLevel: One of these values: QUALITY_LEVEL_SD, QUALITY_LEVEL_HD, QUALITY_LEVEL_FULLHD, or QUALITY_LEVEL_XHD.
Return type: @return:
- IsInitialized As Boolean
- IsMicSupported As Boolean
Returns whether the device has a microphone and we can use it.
- IsWriteStorageSupported As Boolean
Returns whether the device has an external storage device and we can use it.
- SupportsCaptureMode (captureMode As Int) As Boolean
Returns whether the device supports the given capture mode.
captureMode: One of these values: CAPTURE_MODE_FILE or CAPTURE_MODE_STREAM.
- SupportsQualityLevel (qualityLevel As Int) As Boolean
Returns whether the device supports the given quality level.
qualityLevel: One of these values: QUALITY_LEVEL_SD, QUALITY_LEVEL_HD, QUALITY_LEVEL_FULLHD, or QUALITY_LEVEL_XHD.
GPGSVideoCaptureState
Fields:
- CAPTURE_MODE_FILE As Int
Capture device audio and video to a local file.
- CAPTURE_MODE_STREAM As Int
Capture device audio and video, and stream it live.
- CAPTURE_MODE_UNKNOWN As Int
An unknown value to return when capture mode is not available.
- QUALITY_LEVEL_FULLHD As Int
Full HD quality: 2160P resolution and high bit rate, e.g. 10-12Mbps.
- QUALITY_LEVEL_HD As Int
HD quality: DVD HD resolution (i.e. 720p) and a medium bit rate (e.g. 3-4Mbps).
- QUALITY_LEVEL_SD As Int
SD quality: Standard def resolution (e.g. 480p) and a low bit rate (e.g. 1-2Mbps).
- QUALITY_LEVEL_UNKNOWN As Int
An unknown value to return when quality level is not available.
- QUALITY_LEVEL_XHD As Int
Extreme HD quality: BluRay HD resolution (i.e. 1080p) and a high bit rate (e.g. 6-8Mbps).
Functions:
- GetCaptureMode As Int
Returns the capture mode of the current capture. One of CAPTURE_MODE_FILE, CAPTURE_MODE_STREAM, or CAPTURE_MODE_STREAM when not capturing.
- GetCaptureQuality As Int
Returns the quality level of the current capture. One of QUALITY_LEVEL_FULLHD, QUALITY_LEVEL_XHD, QUALITY_LEVEL_HD, QUALITY_LEVEL_SD, or QUALITY_LEVEL_UNKNOWN when not capturing.
- IsCapturing As Boolean
Returns whether the service is currently capturing or not.
- IsInitialized As Boolean
- IsOverlayVisible As Boolean
Returns whether the capture overlay is currently visible or not. This also indicates the capture overlay is being used by the user and background capture will fail.
- IsPaused As Boolean
Returns whether the capture is currently paused or not. Will always be false if isCapturing() if false.
- ToString As String
GPGSVideosClient
Events:
- VideoCaptureAvailable (available As Boolean, statusCode As Int)
- VideoCaptureCapabilitiesReceived (capabilities As GPGSVideoCapabilities, statusCode As Int)
- VideoCaptureOverlayIntentReceived (intent As Intent, statusCode As Int)
- VideoCaptureOverlayStateChanged (state As Int)
- VideoCaptureOverlayStateChangedListenerRemoved (statusCode As Int)
- VideoCaptureStateReceived (status As GPGSVideoCaptureState, statusCode As Int)
- VideoCaptureSupported (supported As Boolean, statusCode As Int)
Fields:
- CAPTURE_OVERLAY_STATE_CAPTURE_STARTED As Int
State used to indicate that the user has initiated capture via the capture overlay.
- CAPTURE_OVERLAY_STATE_CAPTURE_STOPPED As Int
State used to indicate that the user has stopped capturing via the capture overlay.
- CAPTURE_OVERLAY_STATE_DISMISSED As Int
State used to indicate that the user has dismissed the capture overlay and it is no longer visible.
- CAPTURE_OVERLAY_STATE_SHOWN As Int
State used to indicate that the capture overlay is drawn on the screen and visible to the user.
Functions:
- GetCaptureCapabilities
Returns a Task which asynchronously fetches the VideoCapabilities of the service, whether the mic or front-facing camera are supported,
if the service can write to external storage, and what capture modes and quality levels are available.
VideoCaptureCapabilitiesReceived event will be raised.
- GetCaptureOverlayIntent
Asynchronously loads an Intent to launch the capture overlay. This will automatically handle any necessary resolution intents.
VideoCaptureOverlayIntentReceived event will be raised.
- GetCaptureState
Asynchronously fetches the current CaptureState of the capture service. This will inform about whether the capture overlay is visible, if the overlay is actively being used to capture, and a much more. See CaptureState for more details.
VideoCaptureStateReceived event will be raised.
- IsCaptureAvailable (captureMode As Int)
Asynchronously fetches whether the capture service is already in use. Use this call to check if a start capture API call will return VIDEO_ALREADY_CAPTURING.
If the Task result is true, then it's safe to start capturing. If it's already in use then the result is false.
Do not use this call to check if capture is supported, instead use isCaptureSupported() or getCaptureCapabilities().
VideoCaptureAvailable event will be raised.
- IsCaptureSupported
Asynchronously checks whether the device supports capture. If the Task result is true then capture is supported.
VideoCaptureSupported event will be raised.
- IsInitialized As Boolean
- RegisterOnCaptureOverlayStateChangedListener
Asynchronously registers a OnCaptureOverlayStateListener to listen for changes to the overlay state launched by getCaptureOverlayIntent().
Note that only one overlay state listener may be active at a time. Calling this method while another overlay state listener was previously registered will replace the original listener with the new one.
Possible return values include: CAPTURE_OVERLAY_STATE_SHOWN, CAPTURE_OVERLAY_STATE_CAPTURE_STARTED, CAPTURE_OVERLAY_STATE_CAPTURE_STOPPED, CAPTURE_OVERLAY_STATE_DISMISSED.
VideoCaptureOverlayStateChanged event will be raised.
- UnregisterOnCaptureOverlayStateChangedListener
Asynchronously unregisters this client's overlay state update listener, if any, and loads the result. The result will be true if the callback was unregistered and false if this callback wasn't registered previously or is already unregistered.
VideoCaptureOverlayStateChangedListenerRemoved event will be raised if the callback was unregistered successfully.