com.google.android.gms.games.achievement.Achievements |
Entry point for achievements functionality.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Achievements.LoadAchievementsResult | Result delivered when achievement data has been loaded. | ||||||||||
Achievements.UpdateAchievementResult | Result delivered when achievement data has been updated (revealed, unlocked or incremented). |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets an intent to show the list of achievements for a game.
| |||||||||||
Increments an achievement by the given number of steps.
| |||||||||||
Increments an achievement by the given number of steps.
| |||||||||||
Asynchronously load achievement data for the currently signed in player.
| |||||||||||
Reveal a hidden achievement to the currently signed in player.
| |||||||||||
Reveal a hidden achievement to the currently signed in player.
| |||||||||||
Set an achievement to have at least the given number of steps completed.
| |||||||||||
Set an achievement to have at least the given number of steps completed.
| |||||||||||
Unlock an achievement for the currently signed in player.
| |||||||||||
Unlock an achievement for the currently signed in player.
|
Gets an intent to show the list of achievements for a game. Note that this must be invoked
with startActivityForResult(Intent, int)
, so that the identity of the
calling package can be established.
A RESULT_RECONNECT_REQUIRED
may be returned as the
resultCode in onActivityResult(int, int, Intent)
if the GoogleApiClient ends up in an
inconsistent state.
Required API: API
Required Scopes: SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|
Intent
that can be started to view the currently signed in player's
achievements.
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.
This is the fire-and-forget form of the API. Use this form if you don't need to know the
status of the operation immediately. For most applications, this will be the preferred API to
use, though note that the update may not be sent to the server until the next sync. See
incrementImmediate(GoogleApiClient, String, int)
if you need the operation to attempt to communicate to the server
immediately or need to have the status code delivered to your application.
Required API: API
Required Scopes: SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
id | The achievement ID to increment. |
numSteps | The number of steps to increment by. Must be greater than 0. |
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.
This form of the API will attempt to update the user's achievement on the server immediately, and will return a GamesPendingResult that can be used to retrieve the result.
Required API: API
Required Scopes: SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
id | The ID of the achievement to increment. |
numSteps | The number of steps to increment by. Must be greater than 0. |
PendingResult
to access the data when available.
Asynchronously load achievement data for the currently signed in player.
Required API: API
Required Scopes: SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
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. |
PendingResult
to access the data when available.
Reveal a hidden achievement to the currently signed in player. If the achievement has already been unlocked, this will have no effect.
This is the fire-and-forget form of the API. Use this form if you don't need to know the
status of the operation immediately. For most applications, this will be the preferred API to
use, though note that the update may not be sent to the server until the next sync. See
revealImmediate(GoogleApiClient, String)
if you need the operation to attempt to communicate to the server
immediately or need to have the status code delivered to your application.
Required API: API
Required Scopes: SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
id | The achievement ID to reveal |
Reveal a hidden achievement to the currently signed in player. If the achievement is already visible, this will have no effect.
This form of the API will attempt to update the user's achievement on the server immediately, and will return a GamesPendingResult that can be used to retrieve the result.
Required API: API
Required Scopes: SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
id | The ID of the achievement to reveal |
PendingResult
to access the data when available.
Set 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.
This is the fire-and-forget form of the API. Use this form if you don't need to know the
status of the operation immediately. For most applications, this will be the preferred API to
use, though note that the update may not be sent to the server until the next sync. See
setStepsImmediate(GoogleApiClient, String, int)
if you need the operation to attempt to communicate to the server
immediately or need to have the status code delivered to your application.
Required API: API
Required Scopes: SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
id | The ID of the achievement to modify. |
numSteps | The number of steps to set the achievement to. Must be greater than 0. |
Set 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.
This form of the API will attempt to update the user's achievement on the server immediately, and will return a GamesPendingResult that can be used to retrieve the result.
Required API: API
Required Scopes: SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
id | The ID of the achievement to modify. |
numSteps | The number of steps to set the achievement to. Must be greater than 0. |
PendingResult
to access the data when available.
Unlock an achievement for the currently signed in player. If the achievement is hidden this will reveal it to the player.
This is the fire-and-forget form of the API. Use this form if you don't need to know the
status of the operation immediately. For most applications, this will be the preferred API to
use, though note that the update may not be sent to the server until the next sync. See
unlockImmediate(GoogleApiClient, String)
if you need the operation to attempt to communicate to the server
immediately or need to have the status code delivered to your application.
Required API: API
Required Scopes: SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
id | The achievement ID to unlock |
Unlock an achievement for the currently signed in player. If the achievement is hidden this will reveal it to the player.
This form of the API will attempt to update the user's achievement on the server immediately, and will return a GamesPendingResult that can be used to retrieve the result.
Required API: API
Required Scopes: SCOPE_GAMES
apiClient | The GoogleApiClient to service the call. |
---|---|
id | The ID of the achievement to unlock. |
PendingResult
to access the data when available.