Following the deprecation of the[Google Sign-In](https://android-developers.googleblog.com/2024/09/streamlining-android-authentication-credential-manager-replaces-legacy-apis.html)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](https://developer.android.com/games/pgs/android/migrate-to-v2)starting June 2025.  
This guide is for using the Play Games Services v1 SDK. The C++ SDK for Play Games Services v2 is not yet available.

This guide shows you how to use the Events service in a C++ application.

## Before you begin

If you haven't already done so, you might find it helpful to review the[events game concepts](https://developer.android.com/games/pgs/events).

To set up your C++ development environment to use the Events service, follow the instructions in the[Getting Started for C++](https://developer.android.com/games/pgs/v1/cpp)guide. You can download the Play Games services C++ SDK from the[SDK downloads page](https://developer.android.com/games/pgs/downloads#sdk).

Before your game can access events, you must define them first in the[Google Play Console](https://play.google.com/apps/publish/).

## Submit an event

You can add code in your game to notify the Events service whenever an event of interest to your game occurs. Examples of events you could capture in your game are: killing enemies, exploring or returning to various game regions, or acquiring in-game items. Typically, you would call the`Increment`method on the event manager to increment an event's count by 1 every time the player performs an action associated with the event (for example, "Killed one monster").

The following example shows how you might submit the updated event count to the Events service.  

      // Increment the event count when player performs the 'Attack blue
      // monster' action.
      game_services_->Events().Increment(BLUE_MONSTER_EVENT_ID);

## Retrieve events

To retrieve the current count value stored in Google's servers for a specific event, call one of the`Fetch*`methods. You might do this, for example, if you want to show a player's in-game statistics or progress from a custom UI in your game.

The following example shows how you might retrieve and log the event data in your game.  

      // Log Events details.
      LogI("---- Showing Event Counts -----");
      gpg::EventManager::FetchAllCallback callback =
          [](gpg::EventManager::FetchAllResponse const &response) {
        for (auto i : response.data) {
          gpg::Event const &event = i.second;
          LogI("Event name: %s  count: %d", event.Name().c_str(),
               event.Count());
        }
      };
      game_services_->Events().FetchAll(callback);