Google 로그인 API가 지원 중단됨에 따라 2026년에 게임 v1 SDK가 삭제됩니다. 2025년 2월 이후에는 게임 v1 SDK와 새로 통합된 타이틀을 Google Play에 게시할 수 없습니다. 대신 games v2 SDK를 사용하는 것이 좋습니다.
이전 게임 v1 통합이 적용된 기존 타이틀은 몇 년 동안 계속 작동하지만 2025년 6월부터는 v2로 이전하는 것이 좋습니다.
이 가이드는 Play 게임즈 서비스 v1 SDK 사용에 관한 가이드입니다. 최신 SDK 버전에 관한 자세한 내용은 v2 문서를 참고하세요.
eventId는 Google Play Console에서 이벤트를 처음 정의할 때 Play 게임즈 서비스에서 생성되며 게임에서 이 이벤트를 고유하게 식별하는 데 사용됩니다.
incrementAmount 입력을 사용하여 게임별 목표 달성을 위한 플레이어의 양적 진행 상황을 지정할 수 있습니다. 예를 들어 게임에서 추적하려는 이벤트가 '눈이 튀어나온 몬스터 500마리 무찌르기'인 경우 incrementAmount 값은 플레이어가 단일 배틀에서 죽인 몬스터 수가 될 수 있습니다.
다음은 1씩 증가하는 이벤트를 제출하는 방법을 보여주는 예입니다.
public void submitEvent(String eventId) {
Games.getEventsClient(this, GoogleSignIn.getLastSignedInAccount(this))
.increment(eventId, 1);
}
이벤트 가져오기
EventsClient.load()를 호출하여 게임을 위해 Google 서버에 저장된 모든 이벤트 데이터를 가져올 수 있습니다. 메서드 호출에서 Google Play 게임즈 서비스가 사용자 기기에 로컬로 캐시된 데이터를 삭제해야 하는지 나타내는 불리언 값을 전달합니다.
Google Play Console에서 정의한 특정 이벤트의 데이터를 가져오려면 EventsClient.loadByIds()를 호출하고 입력 매개변수에 이벤트 ID 배열을 전달합니다.
다음 스니펫은 Google Play 게임즈 서비스에 게임의 모든 이벤트 목록을 쿼리하는 방법을 보여줍니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","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,["# Events in Android games\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. For information\non the latest SDK version, see the\n[v2 documentation](/games/pgs/android/events).\n\nThis guide shows you how to collect player gameplay data for game analytics using the events APIs\nprovided by Google Play Games Services. The APIs can be found in the\n[`com.google.android.gms.games.event`](https://developers.google.com/android/reference/com/google/android/gms/games/event/package-summary)\nand [`com.google.android.gms.games`](https://developers.google.com/android/reference/com/google/android/gms/games/package-summary).\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\nBefore you start to code using the events APIs:\n\n- Define the events for your game in the [Google Play Console](https://play.google.com/apps/publish/).\n- Follow the [sign-in checklist recommendations](/games/pgs/v1/quality#sign-in).\n\nGet the events client\n---------------------\n\nTo start using the events APIs, your game must first obtain an\n[`EventsClient`](https://developers.google.com/android/reference/com/google/android/gms/games/EventsClient) object. You can do this by calling the\n[`Games.getEventsClient()`](https://developers.google.com/android/reference/com/google/android/gms/games/Games.html#getEventsClient(android.app.Activity,%20com.google.android.gms.auth.api.signin.GoogleSignInAccount)) method and passing in the\nactivity and the [`GoogleSignInAccount`](https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInAccount) for the current player. To learn how to\nretrieve the player account information, see\n[Sign-in in Android Games](/games/pgs/v1/android/signin).\n| **Note:** The [`EventsClient`](https://developers.google.com/android/reference/com/google/android/gms/games/EventsClient) class makes use of the Google Play services [`Task`](https://developers.google.com/android/reference/com/google/android/gms/tasks/Task) class to return results asynchronously. To learn more about using tasks to manage threaded work, see the [Tasks API developer guide](https://developers.google.com/android/guides/tasks).\n\nSubmit events\n-------------\n\nYou can add code in your game to notify Google Play Games Services whenever an\nevent of interest to your game occurs.\n\nTo send an event update, call [`EventsClient.increment()`](https://developers.google.com/android/reference/com/google/android/gms/games/EventsClient.html#increment(java.lang.String,%20int)) with the `eventId` value and an\ninteger `incrementAmount` that is equal to or greater than 0.\n\n- The `eventId` is generated by Google Play Games Services when you first define the event in the Google Play Console and is used to uniquely identify this event in your game.\n- You can use the `incrementAmount` input to specify the player's quantitative progress towards completing some game-specific goal. For example, if the event your game wants to track is *'Defeat 500 bug-eyed monsters'* , the `incrementAmount` value can be the number of monsters that the player killed in a single battle.\n\nHere's an example of how to submit an event with an increment amount of 1: \n\n```text\npublic void submitEvent(String eventId) {\n Games.getEventsClient(this, GoogleSignIn.getLastSignedInAccount(this))\n .increment(eventId, 1);\n}\n```\n\nRetrieve events\n---------------\n\nYou can retrieve all events data stored in Google's servers for your game, by\ncalling [`EventsClient.load()`](https://developers.google.com/android/reference/com/google/android/gms/games/EventsClient.html#load(boolean)). In the\nmethod call, pass in a boolean value to indicate if Google Play Games Services should clear the locally\ncached data on the user's device.\n\nTo retrieve data for specific events that you defined in the Google Play Console, call\n[`EventsClient.loadByIds()`](https://developers.google.com/android/reference/com/google/android/gms/games/EventsClient.html#loadByIds(boolean,%20java.lang.String...)) and pass in an array of event IDs in the input parameters.\n\nThe following snippet shows how you can query Google Play Games Services for the\nlist of all events for your game: \n\n```gdscript\npublic void loadEvents() {\n Games.getEventsClient(this, GoogleSignIn.getLastSignedInAccount(this))\n .load(true)\n .addOnCompleteListener(new OnCompleteListener\u003cAnnotatedData\u003cEventBuffer\u003e\u003e() {\n @Override\n public void onComplete(@NonNull Task\u003cAnnotatedData\u003cEventBuffer\u003e\u003e task) {\n if (task.isSuccessful()) {\n // Process all the events.\n for (Event event : task.getResult().get()) {\n Log.d(TAG, \"loaded event \" + event.getName());\n }\n } else {\n // Handle Error\n Exception exception = task.getException();\n int statusCode = CommonStatusCodes.DEVELOPER_ERROR;\n if (exception instanceof ApiException) {\n ApiException apiException = (ApiException) exception;\n statusCode = apiException.getStatusCode();\n }\n showError(statusCode);\n }\n }\n });\n}\n```"]]