[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-27 UTC。"],[],[],null,["# Add events to your game\n\nFollowing the deprecation of the\n[Google Sign-In](https://android-developers.googleblog.com/2024/09/streamlining-android-authentication-credential-manager-replaces-legacy-apis.html)\nAPI, we are removing the games v1 SDK in 2026. After February 2025, you will be unable to publish\ntitles that are newly integrated with games v1 SDK, on Google Play. We recommend that you use the\ngames v2 SDK instead. \n\nWhile existing titles with the previous games v1 integrations continue to function for a\ncouple of years, you are encouraged to\n[migrate to v2](/games/pgs/android/migrate-to-v2)\nstarting June 2025. \n\nThis guide is for using the Play Games Services v1 SDK. The C++ SDK for\nPlay Games Services v2 is not yet available.\n\nThis guide shows you how to use the Events service in a C++ application.\n\nBefore you begin\n----------------\n\nIf you haven't already done so, you might find it helpful to review the\n[events game concepts](/games/pgs/events).\n\nTo set up your C++ development environment to use the Events service, follow the instructions in the\n[Getting Started for C++](/games/pgs/v1/cpp) guide. You can download\nthe Play Games services C++ SDK from the [SDK downloads page](/games/pgs/downloads#sdk).\n\nBefore your game can access events, you must define them first in\nthe [Google Play Console](https://play.google.com/apps/publish/).\n\nSubmit an event\n---------------\n\nYou can add code in your game to notify the Events service whenever an event of\ninterest to your game occurs. Examples of events you could capture in your\ngame are: killing enemies, exploring or returning to various\ngame regions, or acquiring in-game items. Typically, you would call\nthe `Increment` method on the event manager to increment an event's count by 1 every time the player\nperforms an action associated with the event\n(for example, \"Killed one monster\").\n\nThe following example shows how you might submit the updated event count to\nthe Events service. \n\n // Increment the event count when player performs the 'Attack blue\n // monster' action.\n game_services_-\u003eEvents().Increment(BLUE_MONSTER_EVENT_ID);\n\nRetrieve events\n---------------\n\nTo retrieve the current count value stored in Google's servers for a specific\nevent, call one of the `Fetch*` methods. You might do\nthis, for example, if you want to show a player's in-game statistics or\nprogress from a custom UI in your game.\n\nThe following example shows how you might retrieve and log the event data in\nyour game. \n\n // Log Events details.\n LogI(\"---- Showing Event Counts -----\");\n gpg::EventManager::FetchAllCallback callback =\n [](gpg::EventManager::FetchAllResponse const &response) {\n for (auto i : response.data) {\n gpg::Event const &event = i.second;\n LogI(\"Event name: %s count: %d\", event.Name().c_str(),\n event.Count());\n }\n };\n game_services_-\u003eEvents().FetchAll(callback);"]]