컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
gpg::AndroidInitialization
#include <android_initialization.h>
AndroidInitialization에는 세 가지 초기화 함수가 포함되어 있으며, 이 중 정확히 하나만 호출해야 합니다.
요약
표준 Java 활동의 경우 JNI_OnLoad를 사용해야 합니다. JNI_OnLoad가 호출되지 않는 NativeActivity의 경우 android_main 또는 ANativeActivity_onCreate를 사용해야 합니다. android_main은 android_native_app_glue.h를 사용하여 NativeActivity를 빌드할 때 사용됩니다. ANativeActivity_onCreate는 native_activity.h만 사용하여 NativeActivity를 빌드할 때 사용됩니다. android_native_app_glue.h 및 native_activity.h는 기본 Android 헤더입니다.
적절한 초기화 함수는 AndroidPlatformConfiguration 인스턴스 메서드가 호출되기 전에 정확히 한 번 호출되어야 하며 GameServices 객체가 인스턴스화되기 전에 호출되어야 합니다. 초기화 호출 전에 메서드가 호출되지 않는 한 초기화 호출 중 하나 (예: 구성 객체에 전역 범위가 있는 경우) 전에 AndroidPlatformConfiguration을 인스턴스화할 수 있습니다. 이러한 메서드는 생성된 GameServices 객체당 한 번이 아니라 호출 프로그램의 전체 기간 동안 한 번만 호출하면 됩니다.
공개 정적 함수
|
ANativeActivity_onCreate(ANativeActivity *native_activity, void *savedState, size_t savedStateSize)
|
void
native_activity.h만 기반으로 하는 NativeActivity에서 Play 게임즈 서비스를 사용하는 경우 다른 Play 게임즈 서비스 호출 전에 활동의 ANativeActivity_onCreate 중에 ANativeActivity_onCreate를 호출해야 합니다.
|
JNI_OnLoad(JavaVM *jvm)
|
void
표준 Java 활동에서 Play 게임 서비스를 사용하는 경우 동적 라이브러리의 JNI_OnLoad가 호출될 때 JNI_OnLoad를 호출해야 합니다.
|
android_main(struct android_app *app)
|
void
android_native_app_glue.h를 기반으로 하는 NativeActivity에서 Play 게임즈 서비스를 사용하는 경우 다른 Play 게임즈 서비스 호출 전에 활동의 android_main 중에 android_main을 호출해야 합니다.
|
공개 정적 함수
ANativeActivity_onCreate
void gpg::AndroidInitialization::ANativeActivity_onCreate(
ANativeActivity *native_activity,
void *savedState,
size_t savedStateSize
)
native_activity.h만 기반으로 하는 NativeActivity에서 Play 게임즈 서비스를 사용하는 경우 다른 Play 게임즈 서비스 호출 전에 활동의 ANativeActivity_onCreate 중에 ANativeActivity_onCreate를 호출해야 합니다.
JNI_OnLoad
void gpg::AndroidInitialization::JNI_OnLoad(
JavaVM *jvm
)
표준 Java 활동에서 Play 게임 서비스를 사용하는 경우 동적 라이브러리의 JNI_OnLoad가 호출될 때 JNI_OnLoad를 호출해야 합니다.
android_main
void gpg::AndroidInitialization::android_main(
struct android_app *app
)
android_native_app_glue.h를 기반으로 하는 NativeActivity에서 Play 게임즈 서비스를 사용하는 경우 다른 Play 게임즈 서비스 호출 전에 활동의 android_main 중에 android_main을 호출해야 합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# gpg::AndroidInitialization Struct Reference\n\ngpg::AndroidInitialization\n==========================\n\n`#include \u003candroid_initialization.h\u003e`\n\n[AndroidInitialization](/games/services/cpp/api/struct/gpg/android-initialization#structgpg_1_1_android_initialization) includes three initialization functions, exactly one of which must be called.\n\nSummary\n-------\n\nIn the case of a standard Java Activity, JNI_OnLoad should be used. In the case of a NativeActivity where JNI_OnLoad will not be called, either android_main or ANativeActivity_onCreate should be used. android_main is used when building a NativeActivity using android_native_app_glue.h. ANativeActivity_onCreate is used when building a NativeActivity using just native_activity.h. android_native_app_glue.h and native_activity.h are default Android headers.\n\nThe appropriate initialization function must be called exactly once before any [AndroidPlatformConfiguration](/games/services/cpp/api/class/gpg/android-platform-configuration#classgpg_1_1_android_platform_configuration) instance methods are called, and it must be called before a [GameServices](/games/services/cpp/api/class/gpg/game-services#classgpg_1_1_game_services) object is instantiated. It is permitted to instantiate a [AndroidPlatformConfiguration](/games/services/cpp/api/class/gpg/android-platform-configuration#classgpg_1_1_android_platform_configuration) before one of the initialization calls (for example, if the configuration object has global scope), as long as no methods are called before the initialization call. These methods need be called only once in the lifetime of the calling program, not once per [GameServices](/games/services/cpp/api/class/gpg/game-services#classgpg_1_1_game_services) object created.\n\n| ### Public static functions ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [ANativeActivity_onCreate](#structgpg_1_1_android_initialization_1a816753e9576f07d1d58f2e94b26ad66c)`(ANativeActivity *native_activity, void *savedState, size_t savedStateSize)` | `void` When using Play Game Services with a NativeActivity which is based on only native_activity.h, ANativeActivity_onCreate should be called during your activity's ANativeActivity_onCreate, before any other Play Game Services calls. |\n| [JNI_OnLoad](#structgpg_1_1_android_initialization_1ae43182cd58941ddc74eb07535c8de97a)`(JavaVM *jvm)` | `void` When using Play Game Services with a standard Java Activity, JNI_OnLoad should be called when the dynamic library's JNI_OnLoad is called. |\n| [android_main](#structgpg_1_1_android_initialization_1ace2b90a82cc0b9ad5aeb7ac73996b100)`(struct android_app *app)` | `void` When using Play Game Services with a NativeActivity which is based on android_native_app_glue.h, android_main should be called during your activity's android_main, before any other Play Game Services calls. |\n\nPublic static functions\n-----------------------\n\n### ANativeActivity_onCreate\n\n```c++\nvoid gpg::AndroidInitialization::ANativeActivity_onCreate(\n ANativeActivity *native_activity,\n void *savedState,\n size_t savedStateSize\n)\n``` \nWhen using Play Game Services with a NativeActivity which is based on only native_activity.h, ANativeActivity_onCreate should be called during your activity's ANativeActivity_onCreate, before any other Play Game Services calls. \n\n### JNI_OnLoad\n\n```c++\nvoid gpg::AndroidInitialization::JNI_OnLoad(\n JavaVM *jvm\n)\n``` \nWhen using Play Game Services with a standard Java Activity, JNI_OnLoad should be called when the dynamic library's JNI_OnLoad is called. \n\n### android_main\n\n```c++\nvoid gpg::AndroidInitialization::android_main(\n struct android_app *app\n)\n``` \nWhen using Play Game Services with a NativeActivity which is based on android_native_app_glue.h, android_main should be called during your activity's android_main, before any other Play Game Services calls."]]