Following the deprecation of the Google Sign-In
API, we are removing the games v1 SDK in 2026. After February 2025, you will be unable to publish titles that are newly integrated with games v1 SDK, on Google Play. We recommend that you use the games v2 SDK instead.While existing titles with the previous games v1 integrations continue to function for a couple of years, you are encouraged to migrate to v2
starting June 2025.
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
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.
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-01-24 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-01-24 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eEventsClient\u003c/code\u003e allows interaction with game event functionalities for the currently signed-in player.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to increment event counts, load event data, and load data for specific events.\u003c/p\u003e\n"],["\u003cp\u003eEvent increments are cached locally and sent to the server periodically, while loading event data offers options for refreshing cached data.\u003c/p\u003e\n"],["\u003cp\u003eLoaded event data is contained in an \u003ccode\u003eEventBuffer\u003c/code\u003e within an \u003ccode\u003eAnnotatedData\u003c/code\u003e object, and resources should be released using \u003ccode\u003eAbstractDataBuffer.release()\u003c/code\u003e after use.\u003c/p\u003e\n"]]],["The `EventsClient` interface facilitates interaction with event data. It allows incrementing an event's progress via `increment(eventId, incrementAmount)`. It also enables loading event data through two methods: `load(forceReload)`, which retrieves data for the signed-in player, and `loadByIds(forceReload, eventIds)`, which retrieves data for specific event IDs. Both `load` methods use asynchronous tasks and support forced data reloading, bypassing cached data.\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/games_v1/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](/android/reference/com/google/android/gms/tasks/Task)\\\u003c[AnnotatedData](/android/games_v1/reference/com/google/android/gms/games/AnnotatedData)\\\u003c[EventBuffer](/android/games_v1/reference/com/google/android/gms/games/event/EventBuffer)\\\u003e\\\u003e | [load](/android/games_v1/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/games_v1/reference/com/google/android/gms/games/event/EventBuffer) that represents the event data for the currently signed-in player. |\n| abstract [Task](/android/reference/com/google/android/gms/tasks/Task)\\\u003c[AnnotatedData](/android/games_v1/reference/com/google/android/gms/games/AnnotatedData)\\\u003c[EventBuffer](/android/games_v1/reference/com/google/android/gms/games/event/EventBuffer)\\\u003e\\\u003e | [loadByIds](/android/games_v1/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/games_v1/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](/android/reference/com/google/android/gms/tasks/Task)\\\u003c[AnnotatedData](/android/games_v1/reference/com/google/android/gms/games/AnnotatedData)\\\u003c[EventBuffer](/android/games_v1/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/games_v1/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](/android/reference/com/google/android/gms/tasks/Task)\\\u003c[AnnotatedData](/android/games_v1/reference/com/google/android/gms/games/AnnotatedData)\\\u003c[EventBuffer](/android/games_v1/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/games_v1/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|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|"]]