The Player class is used to return the specific information about a player. When the PlayersClient.getCurrentPlayer method is called, an instance of the Player type is returned.
| Return | Method |
| String | getDisplayName() Obtains the player nickname. |
| Uri | getHiResImageUri() Obtains the URI of the high-resolution profile image of a player. |
| Uri | getIconImageUri() Obtains the URI of the icon-size profile image of a player. |
| int | getLevel() Obtains the player level information. Currently, this method can obtain only the level information about players in Chinese Mainland. For players outside Chinese Mainland, this method returns 1. |
| String | getPlayerId() Obtains the game account ID assigned by Huawei to a player. The ID uniquely identifies the player in the app. |
| boolean | hasHiResImage() Checks whether the player has a high-resolution profile image. |
| boolean | hasIconImage() Checks whether the player has an icon-size profile image. |
| String | getPlayerSign() Obtains the sign-in signature of a player. The app server can call the Verifying Login Signature API based on the sign-in signature to verify the player ID on the Huawei server. |
| String | getSignTs() Obtains the timestamp information to be submitted during sign-in signature verification. |
Obtains the player nickname.
Return Values
| type | description |
| String | String of the player nickname displayed in the game. |
Obtains the URI of the high-resolution profile image of a player. The URI needs to be obtained only when the hasHiResImage() method returns true.
Return Values
| type | description |
| Uri | URI of the high-resolution profile image of a player. If the player does not have a high-resolution profile image, this method returns null. |
Obtains the URI of the icon-size profile image of a player. The URI needs to be obtained only when the hasIconImage() method returns true.
Return Values
| type | description |
| Uri | URI of the icon-size profile image of a player. If the player does not have a profile image, this method returns null. |
Obtains the player level information. Currently, this method can obtain only level information about players in Chinese Mainland. For players outside Chinese Mainland, this method returns 1.
Return Values
| type | description |
| int | The player level. If a player has no level information or is not in the Chinese Mainland, 1 is returned. |
Obtains the player ID.
Return Values
| type | description |
| String | Player ID. |
Checks whether the player has a high-resolution profile image.
Return Values
| type | description |
| boolean | ● true: The player has a high-resolution profile image. The app can call the getHiResImageUri() method to obtain the URI of the profile image. ● false: The player does not have a high-resolution profile image. |
Checks whether the player has an icon-size profile image.
Return Values
| type | description |
| boolean | ● true: The player has an icon-size profile image. The app can call the getIconImageUri() method to obtain the URI of the profile image. ● false: The player does not have an icon-size profile image. |
Obtains the sign-in signature of the player, which is used for initiating sign-in signature verification to the Huawei game server when the app server calls the Verifying Login Signature API.
Return Values
| type | description |
| String | Sign-in signature string. |
Obtains the timestamp returned by the Huawei game server, which is used for initiating sign-in signature verification to the Huawei game server when the app server calls the Verifying Login Signature API.
Return Values
| type | description |
| String | Timestamp string. By default, the timestamp is valid for five minutes. The sign-in signature must be verified when the timestamp is valid. Otherwise, the sign-in signature fails the verification. |