目录

The EventsClient class defines the APIs related to event management, such as submitting event data and obtaining the event data of the current player.

Public Method Summary

return typedescription

void

grow(String eventId, int growAmount)

Submits the event data of the current player.

Task<List<Event>>

getEventList(boolean forceReload)

Obtains all event data of the current player.

Task<List<Event>>

getEventListByIds(boolean forceReload, String[] eventIds)

Obtains the event data of the current player for specified events.

Public Methods

public void grow(String eventId, int growAmount)

Submits event data.

This method submits data asynchronously. That is, if the network is unavailable when the app calls this method, the HMS SDK caches the data locally. After the network is recovered, the HMS SDK submits the data to Huawei server. Developers do not need to pay attention to the execution result of this method.

Input Parameters

parameterdescription

eventId

ID of the event to be submitted.

growAmount

Increment amount of the existing event value.

public Task<List<Event>> getEventList (boolean forceReload)

Obtains all event data of the current player.

Input Parameters

parameterdescription

forceReload

Indicates whether to load the event list stored on the server or cached locally.

  • true: server

  • false: local cache

Return Values

The list of Event obejct.

public Task<List<Event>> getEventListByIds(boolean forceReload, String[] eventIds)

Obtains the event data of the current player for specified events. Data of one or more events can be obtained.

Input Parameters

parameterdescription

forceReload

Indicates whether to load the event list stored on the server or cached locally.

  • true: server

  • false: local cache

eventIds

IDs of the events to be obtained. The value is a string array.

Return Values

The list of Event obejct.