The GamePlayerStatisticsClient class defines the APIs related to player information statistics.
Return | Method |
Task<GamePlayerStatistics> | getGamePlayerStatistics(boolean isRealTime) Obtains the statistics of the current player, such as the session duration and rank. |
Obtains the statistics of the current player asynchronously, such as the session duration and rank. The statistics can be obtained from the local cache or Huawei game server.
Input Parameters
Parameter Name | Parameter Description |
isRealTime | Indicates whether to obtain data from Huawei game server.
|
Return Values
Type | Description |
Task<GamePlayerStatistics> | The statistics about the current player. |
You need to set two callback listeners in the Task returned by the API. OnSuccessListener obtains the data returned in the success scenario, and OnFailureListener obtains the information about the request failure. In OnFailureListener, you need to check whether the exception object called back in this mode is an ApiException instance object, and resolve the failure according to getStatusCode() contained in the ApiException instance.