EventsClient
Stay organized with collections
Save and categorize content based on your preferences.
A client to interact with events functionality.
Public Methods
public abstract void increment (String eventId, int
incrementAmount)
Increments an event specified by eventId
by the given number of
steps.
This is the fire-and-forget API. Event increments are cached locally and flushed to
the server in batches.
Parameters
eventId |
The event ID to increment. |
incrementAmount |
The amount increment by. Must be greater than or equal to 0. |
public abstract Task<AnnotatedData<EventBuffer>>
load (boolean
forceReload)
Parameters
forceReload |
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. |
public abstract Task<AnnotatedData<EventBuffer>>
loadByIds (boolean
forceReload, String...
eventIds)
Parameters
forceReload |
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. |
eventIds |
The IDs of the events to load. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-23 UTC."],[[["\u003cp\u003e\u003ccode\u003eEventsClient\u003c/code\u003e enables interaction with game event functionalities for the currently signed-in player.\u003c/p\u003e\n"],["\u003cp\u003eIt allows incrementing event counts, loading event data, and loading data for specific events by ID.\u003c/p\u003e\n"],["\u003cp\u003eEvent increments are cached locally and flushed to the server periodically, while loading event data offers options for refreshing cached data.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers should release resources associated with loaded event data using \u003ccode\u003eAbstractDataBuffer.release()\u003c/code\u003e after usage.\u003c/p\u003e\n"]]],[],null,["# EventsClient\n\npublic interface **EventsClient** \nA client to interact with events functionality. \n\n### Public Method Summary\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [increment](/android/reference/com/google/android/gms/games/EventsClient#increment(java.lang.String,%20int))([String](//developer.android.com/reference/java/lang/String.html) eventId, int incrementAmount) Increments an event specified by `eventId` by the given number of steps. |\n| abstract Task\\\u003c[AnnotatedData](/android/reference/com/google/android/gms/games/AnnotatedData)\\\u003c[EventBuffer](/android/reference/com/google/android/gms/games/event/EventBuffer)\\\u003e\\\u003e | [load](/android/reference/com/google/android/gms/games/EventsClient#load(boolean))(boolean forceReload) Returns a [Task](/android/reference/com/google/android/gms/tasks/Task) which asynchronously loads an annotated [EventBuffer](/android/reference/com/google/android/gms/games/event/EventBuffer) that represents the event data for the currently signed-in player. |\n| abstract Task\\\u003c[AnnotatedData](/android/reference/com/google/android/gms/games/AnnotatedData)\\\u003c[EventBuffer](/android/reference/com/google/android/gms/games/event/EventBuffer)\\\u003e\\\u003e | [loadByIds](/android/reference/com/google/android/gms/games/EventsClient#loadByIds(boolean,%20java.lang.String...))(boolean forceReload, [String...](//developer.android.com/reference/java/lang/String.html) eventIds) Returns a [Task](/android/reference/com/google/android/gms/tasks/Task) which asynchronously loads an annotated [EventBuffer](/android/reference/com/google/android/gms/games/event/EventBuffer) that represents the event data for the specified event IDs. |\n\nPublic Methods\n--------------\n\n#### public abstract void **increment** ([String](//developer.android.com/reference/java/lang/String.html) eventId, int incrementAmount)\n\nIncrements an event specified by `eventId` by the given number of\nsteps.\n\nThis is the fire-and-forget API. Event increments are cached locally and flushed to\nthe server in batches. \n\n##### Parameters\n\n| eventId | The event ID to increment. |\n| incrementAmount | The amount increment by. Must be greater than or equal to 0. |\n|-----------------|--------------------------------------------------------------|\n\n#### public abstract Task\\\u003c[AnnotatedData](/android/reference/com/google/android/gms/games/AnnotatedData)\\\u003c[EventBuffer](/android/reference/com/google/android/gms/games/event/EventBuffer)\\\u003e\\\u003e\n**load** (boolean forceReload)\n\nReturns a [Task](/android/reference/com/google/android/gms/tasks/Task) which\nasynchronously loads an annotated [EventBuffer](/android/reference/com/google/android/gms/games/event/EventBuffer)\nthat represents the event data for the currently signed-in player.\n\n[AbstractDataBuffer.release()](/android/reference/com/google/android/gms/common/data/AbstractDataBuffer#release()) should be called to release resources after\nusage. \n\n##### Parameters\n\n| forceReload | 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. |\n|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public abstract Task\\\u003c[AnnotatedData](/android/reference/com/google/android/gms/games/AnnotatedData)\\\u003c[EventBuffer](/android/reference/com/google/android/gms/games/event/EventBuffer)\\\u003e\\\u003e\n**loadByIds** (boolean forceReload, [String...](//developer.android.com/reference/java/lang/String.html) eventIds)\n\nReturns a [Task](/android/reference/com/google/android/gms/tasks/Task) which\nasynchronously loads an annotated [EventBuffer](/android/reference/com/google/android/gms/games/event/EventBuffer)\nthat represents the event data for the specified event IDs.\n\n[AbstractDataBuffer.release()](/android/reference/com/google/android/gms/common/data/AbstractDataBuffer#release()) should be called to release resources after\nusage. \n\n##### Parameters\n\n| forceReload | 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. |\n| eventIds | The IDs of the events to load. |\n|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|"]]