java.lang.Object | ||
↳ | com.google.android.gms.common.api.GoogleApi<com.google.android.gms.games.Games.GamesOptions> | |
↳ | com.google.android.gms.games.LeaderboardsClient |
A client to interact with leaderboards functionality.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
LeaderboardsClient.LeaderboardScores | Result delivered when leaderboard scores have been loaded. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a
Task which asynchronously loads an annotated LeaderboardScore that
represents the signed-in player's score for the leaderboard specified by leaderboardId . | |||||||||||
Returns a
Task which asynchronously loads an annotated LeaderboardBuffer that
represents a list of leaderboards metadata for this game. | |||||||||||
Returns a
Task which asynchronously loads an annotated LeaderboardsClient.LeaderboardScores that
represents an additional page of score data for the given score buffer. | |||||||||||
Returns a
Task which asynchronously loads an annotated LeaderboardsClient.LeaderboardScores that
represents the player-centered page of scores for the leaderboard specified by leaderboardId . | |||||||||||
Returns a
Task which asynchronously loads an annotated LeaderboardsClient.LeaderboardScores that
represents the player-centered page of scores for the leaderboard specified by leaderboardId . | |||||||||||
Returns a
Task which asynchronously loads an annotated LeaderboardsClient.LeaderboardScores that
represents the top page of scores for a given leaderboard specified by leaderboardId . | |||||||||||
Returns a
Task which asynchronously loads an annotated LeaderboardsClient.LeaderboardScores that
represents the top page of scores for the leaderboard specified by leaderboardId . | |||||||||||
Submit a score to a leaderboard for the currently signed-in player.
| |||||||||||
Submit a score to a leaderboard for the currently signed-in player.
| |||||||||||
Returns a
Task which asynchronously submits the score to the leaderboard for
the currently signed-in player. | |||||||||||
Returns a
Task which asynchronously submits the score to the leaderboard for
the currently signed-in player. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Returns a Task
which asynchronously loads an Intent
to show the list of
leaderboards for a game. Note that this must be invoked with startActivityForResult(Intent, int)
, so that the identity of the calling package can
be established.
The returned Task
can fail with a RemoteException
.
Required Scopes: SCOPE_GAMES_LITE
Returns | |
---|---|
Task<Intent> |
Returns a Task
which asynchronously loads an Intent
to show a leaderboard for a
game specified by a leaderboardId
. Note that the Intent
returned from the
Task
must be invoked with startActivityForResult(Intent, int)
, so that
the identity of the calling package can be established.
The returned Task
can fail with a RemoteException
.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : The ID of the leaderboard to view. |
timeSpan |
int : Time span to retrieve data for. Valid values are TIME_SPAN_DAILY , TIME_SPAN_WEEKLY , or TIME_SPAN_ALL_TIME .
|
Returns | |
---|---|
Task<Intent> |
Returns a Task
which asynchronously loads an Intent
to show a leaderboard for a
game specified by a leaderboardId
. Note that the Intent
returned from the
Task
must be invoked with startActivityForResult(Intent, int)
, so that
the identity of the calling package can be established.
The returned Task
can fail with a RemoteException
.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : The ID of the leaderboard to view.
|
Returns | |
---|---|
Task<Intent> |
Returns a Task
which asynchronously loads an Intent
to show a leaderboard for a
game specified by a leaderboardId
. Note that the Intent
returned from the
Task
must be invoked with startActivityForResult(Intent, int)
, so that
the identity of the calling package can be established.
The returned Task
can fail with a RemoteException
.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : The ID of the leaderboard to view. |
timeSpan |
int : Time span to retrieve data for. Valid values are TIME_SPAN_DAILY , TIME_SPAN_WEEKLY , or TIME_SPAN_ALL_TIME . |
collection |
int : The collection to show by default. Valid values are COLLECTION_PUBLIC or COLLECTION_SOCIAL .
|
Returns | |
---|---|
Task<Intent> |
Returns a Task
which asynchronously loads an annotated LeaderboardScore
that
represents the signed-in player's score for the leaderboard specified by leaderboardId
.
See Leaderboards.LoadPlayerScoreResult
for possible error codes.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : ID of the leaderboard to load the score from. |
span |
int : Time span to retrieve data for. Valid values are TIME_SPAN_DAILY , TIME_SPAN_WEEKLY , or TIME_SPAN_ALL_TIME . |
leaderboardCollection |
int : The leaderboard collection to retrieve scores for. Valid values
are either COLLECTION_PUBLIC or COLLECTION_SOCIAL .
|
Returns | |
---|---|
Task<AnnotatedData<LeaderboardScore>> |
Returns a Task
which asynchronously loads an annotated LeaderboardBuffer
that
represents a list of leaderboards metadata for this game. See Leaderboards.LeaderboardMetadataResult
for possible error codes.
release()
should be called to release resources after usage.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
forceReload |
boolean : 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.
|
Returns | |
---|---|
Task<AnnotatedData<LeaderboardBuffer>> |
Returns a Task
which asynchronously loads an annotated Leaderboard
specified by
leaderboardId
. See Leaderboards.LeaderboardMetadataResult
for possible error codes.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : ID of the leaderboard to load metadata for. |
forceReload |
boolean : 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.
|
Returns | |
---|---|
Task<AnnotatedData<Leaderboard>> |
Returns a Task
which asynchronously loads an annotated LeaderboardsClient.LeaderboardScores
that
represents an additional page of score data for the given score buffer. A new score buffer will
be delivered that replaces the given buffer.
release()
should be called to release resources after usage.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
buffer |
LeaderboardScoreBuffer : The existing buffer that will be expanded. The buffer is allowed to be closed
prior to being passed in to this method. |
maxResults |
int : 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 |
int : The direction to expand the buffer. Values are defined in PageDirection .
|
Returns | |
---|---|
Task<AnnotatedData<LeaderboardsClient.LeaderboardScores>> |
Returns a Task
which asynchronously loads an annotated LeaderboardsClient.LeaderboardScores
that
represents 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.
release()
should be called to release resources after usage.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : ID of the leaderboard. |
span |
int : Time span to retrieve data for. Valid values are TIME_SPAN_DAILY , TIME_SPAN_WEEKLY , or TIME_SPAN_ALL_TIME . |
leaderboardCollection |
int : The leaderboard collection to retrieve scores for. Valid values
are either COLLECTION_PUBLIC or COLLECTION_SOCIAL . |
maxResults |
int : The maximum number of scores to fetch per page. Must be between 1 and 25. |
forceReload |
boolean : 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.
|
Returns | |
---|---|
Task<AnnotatedData<LeaderboardsClient.LeaderboardScores>> |
Returns a Task
which asynchronously loads an annotated LeaderboardsClient.LeaderboardScores
that
represents 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.
release()
should be called to release resources after usage.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : ID of the leaderboard. |
span |
int : Time span to retrieve data for. Valid values are TIME_SPAN_DAILY , TIME_SPAN_WEEKLY , or TIME_SPAN_ALL_TIME . |
leaderboardCollection |
int : The leaderboard collection to retrieve scores for. Valid values
are either COLLECTION_PUBLIC or COLLECTION_SOCIAL . |
maxResults |
int : The maximum number of scores to fetch per page. Must be between 1 and 25.
|
Returns | |
---|---|
Task<AnnotatedData<LeaderboardsClient.LeaderboardScores>> |
Returns a Task
which asynchronously loads an annotated LeaderboardsClient.LeaderboardScores
that
represents the top page of scores for a given leaderboard specified by leaderboardId
.
release()
should be called to release resources after usage.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : ID of the leaderboard. |
span |
int : Time span to retrieve data for. Valid values are TIME_SPAN_DAILY , TIME_SPAN_WEEKLY , or TIME_SPAN_ALL_TIME . |
leaderboardCollection |
int : The leaderboard collection to retrieve scores for. Valid values
are either COLLECTION_PUBLIC or COLLECTION_SOCIAL . |
maxResults |
int : The maximum number of scores to fetch per page. Must be between 1 and 25.
|
Returns | |
---|---|
Task<AnnotatedData<LeaderboardsClient.LeaderboardScores>> |
Returns a Task
which asynchronously loads an annotated LeaderboardsClient.LeaderboardScores
that
represents the top page of scores for the leaderboard specified by leaderboardId
.
release()
should be called to release resources after usage.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : ID of the leaderboard. |
span |
int : Time span to retrieve data for. Valid values are TIME_SPAN_DAILY , TIME_SPAN_WEEKLY , or TIME_SPAN_ALL_TIME . |
leaderboardCollection |
int : The leaderboard collection to retrieve scores for. Valid values
are either COLLECTION_PUBLIC or COLLECTION_SOCIAL . |
maxResults |
int : The maximum number of scores to fetch per page. Must be between 1 and 25. |
forceReload |
boolean : 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.
|
Returns | |
---|---|
Task<AnnotatedData<LeaderboardsClient.LeaderboardScores>> |
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.
This form of the API is a fire-and-forget form. 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:
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.
score
represents an elapsed time in milliseconds. The value will be
formatted as an appropriate time value.
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
For more details, please see Leaderboard Concepts.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : The leaderboard to submit the score to. |
score |
long : The raw score value. |
scoreTag |
String : 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.
|
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.
This form of the API is a fire-and-forget form. 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:
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.
score
represents an elapsed time in milliseconds. The value will be
formatted as an appropriate time value.
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
For more details, please see Leaderboard Concepts.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : The leaderboard to submit the score to. |
score |
long : The raw score value.
|
Returns a Task
which 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 or the same player.
This form of the API will attempt to submit the score to the server immediately within the
task, returning a ScoreSubmissionData
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:
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.
score
represents an elapsed time in milliseconds. The value will be
formatted as an appropriate time value.
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
For more details, please see this page.
The returned Task
will fail with an IllegalArgumentException
if scoreTag
is malformed.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : The leaderboard to submit the score to. |
score |
long : The raw score value. |
scoreTag |
String : 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.
|
Returns | |
---|---|
Task<ScoreSubmissionData> |
Returns a Task
which 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 or the same player.
This form of the API will attempt to submit the score to the server immediately within the
task, returning a ScoreSubmissionData
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:
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.
score
represents an elapsed time in milliseconds. The value will be
formatted as an appropriate time value.
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
For more details, please see this page.
Required Scopes: SCOPE_GAMES_LITE
Parameters | |
---|---|
leaderboardId |
String : The leaderboard to submit the score to. |
score |
long : The raw score value.
|
Returns | |
---|---|
Task<ScoreSubmissionData> |