LeaderboardScore | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Constants | Methods | Inherited Methods | [Expand All]
public interface

# LeaderboardScore

implements Freezable<T>

com.google.android.gms.games.leaderboard.LeaderboardScore

## Class Overview

Data interface representing a single score on a leaderboard.

## Summary

Constants
int | LEADERBOARD_RANK_UNKNOWN | Constant indicating that the score holder's rank was not known.

Public Methods
abstract void | getDisplayRank(CharArrayBuffer dataOut) Load the formatted display rank into the given `CharArrayBuffer`.
abstract String | getDisplayRank() Retrieves a formatted string to display for this rank.
abstract String | getDisplayScore() Retrieves a formatted string to display for this score.
abstract void | getDisplayScore(CharArrayBuffer dataOut) Loads the formatted display score into the given `CharArrayBuffer`.
abstract long | getRank() Retrieves the rank returned from the server for this score.
abstract long | getRawScore() Retrieves the raw score value.
abstract Player | getScoreHolder() Retrieves the player that scored this particular score.
abstract void | getScoreHolderDisplayName(CharArrayBuffer dataOut) Load the display name of the player who scored this score into the provided `CharArrayBuffer`.
abstract String | getScoreHolderDisplayName() Retrieves the name to display for the player who scored this score.
abstract Uri | getScoreHolderHiResImageUri() Retrieves the URI of the hi-res image to display for the player who scored this score.
abstract Uri | getScoreHolderIconImageUri() Retrieves the URI of the icon image to display for the player who scored this score.
abstract String | getScoreTag() Retrieve the optional score tag associated with this score, if any.
abstract long | getTimestampMillis() Retrieves the timestamp (in milliseconds from epoch) at which this score was achieved.

[Expand] Inherited Methods
From interface com.google.android.gms.common.data.Freezable
abstract T | freeze() Freeze a volatile representation into an immutable representation.
abstract boolean | isDataValid() Check to see if this object is valid for use.

## Constants

#### public static final int LEADERBOARD_RANK_UNKNOWN

Constant indicating that the score holder's rank was not known.

Constant Value: -1 (0xffffffff)

## Public Methods

#### public abstract void getDisplayRank (CharArrayBuffer dataOut)

Load the formatted display rank into the given `CharArrayBuffer`.

##### Parameters

dataOut | The buffer to load the data into.

#### public abstract String getDisplayRank ()

Retrieves a formatted string to display for this rank. This handles appropriate localization and formatting.

##### Returns

- Formatted string to display.

#### public abstract String getDisplayScore ()

Retrieves a formatted string to display for this score. The details of the formatting are specified by the developer in their dev console.

##### Returns

- Formatted string to display.

#### public abstract void getDisplayScore (CharArrayBuffer dataOut)

Loads the formatted display score into the given `CharArrayBuffer`.

##### Parameters

dataOut | The buffer to load the data into.

#### public abstract long getRank ()

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`.

##### Returns

- Rank of score.

#### public abstract long getRawScore ()

Retrieves the raw score value.

##### Returns

- The raw score value.

#### public abstract Player getScoreHolder ()

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. Instead, cache the result of `freeze()`.

##### Returns

- The player associated with this leaderboard score.

#### public abstract void getScoreHolderDisplayName (CharArrayBuffer dataOut)

Load the display name of the player who scored this score into the provided `CharArrayBuffer`.

##### Parameters

dataOut | The buffer to load the data into.

#### public abstract String getScoreHolderDisplayName ()

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.

##### Returns

- The display name of the holder of this score.

#### public abstract Uri getScoreHolderHiResImageUri ()

Retrieves the URI of the hi-res 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.

To retrieve the Image from the `Uri`, use `ImageManager`.

##### Returns

- The URI of the hi-res image to display for this score.

#### public abstract Uri getScoreHolderIconImageUri ()

Retrieves the URI of the icon image to display for the player who scored this score. If the identity of the player is unknown, this will return an anonymous image for the player. It may also be null if the player simply has no image.

To retrieve the Image from the `Uri`, use `ImageManager`.

##### Returns

- The URI of the icon image to display for this score.

#### public abstract String getScoreTag ()

Retrieve the optional score tag associated with this score, if any.

##### Returns

- The score tag associated with this score.

#### public abstract long getTimestampMillis ()

Retrieves the timestamp (in milliseconds from epoch) at which this score was achieved.

##### Returns

- Timestamp when this score was achieved.