支援 Google Play 遊戲服務
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
警告:Google Play 免安裝功能已停用。自 2025 年 12 月起,您無法透過 Google Play 發布免安裝應用程式,所有 Google Play 服務 Instant API 也將停止運作。使用者將無法再透過任何機制,取得 Play 提供的免安裝應用程式。
我們會根據開發人員的意見,以及自推出 Google Play 免安裝功能以來持續投入的資源,做出這項變更,以改善生態系統。
如要持續促進使用人數成長,我們建議開發人員使用深層連結將使用者導向標準版應用程式或遊戲,並在適當情況下將他們重新導向特定歷程或功能。
所有即時遊玩遊戲都必須支援使用 Google Play 遊戲服務自動登入。使用 Google Play 遊戲服務提供一致的玩家 ID,以便從雲端還原已儲存的進度。
程式庫的大小影響
Google Play 遊戲服務程式庫的大小影響取決於遊戲引擎是否在 Unity、Java 或原生環境中執行。
Java
由於 ProGuard 會得知使用哪些類別,因此大小影響程度不大。
Unity
您可以使用官方 Google Play 遊戲服務外掛程式,將遊戲儲存功能整合至 Unity 遊戲。如果您採用 ProGuard 建議,大小影響約為 200 KB。
原生
您可以使用 Native Play 遊戲服務 SDK,將遊戲儲存功能整合至以 Android NDK 建構的遊戲。
請使用下方的一般 ProGuard 設定,移除程式庫所包含的大部分 Java 程式碼。您可以使用這項設定導入 Play 遊戲服務登入功能和遊戲儲存功能,同時只為 APK 新增約 250 KB 的內容。
# The native PGS library wraps the Java PGS SDK using reflection.
-dontobfuscate
-keeppackagenames
# Needed for callbacks.
-keepclasseswithmembernames,includedescriptorclasses class * {
native <methods>;
}
# Needed for helper libraries.
-keep class com.google.example.games.juihelper.** {
public protected *;
}
-keep class com.sample.helper.** {
public protected *;
}
# Needed for GoogleApiClient and auth stuff.
-keep class com.google.android.gms.common.api.** {
public protected *;
}
# Keep all of the "nearby" library, which is needed by the native PGS library
# at runtime (though deprecated).
-keep class com.google.android.gms.nearby.** {
public protected *;
}
# Keep all of the public PGS APIs.
-keep class com.google.android.gms.games.** {
public protected *;
}
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-08-28 (世界標準時間)。
[[["容易理解","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-08-28 (世界標準時間)。"],[],[],null,["**Warning:** Google Play Instant will no longer be available. Starting December 2025,\nInstant Apps cannot be published through Google Play, and all\n[Google Play services Instant APIs](https://developers.google.com/android/reference/com/google/android/gms/instantapps/package-summary)\nwill no longer work. Users will no longer be served Instant Apps by Play using any\nmechanism.\n\nWe're making this change based on developer feedback and our continuous investments\nto improve the ecosystem since the introduction of Google Play Instant.\n\nTo continue optimizing for user growth, we encourage developers to refer users to\ntheir regular app or game, using [deeplinks](https://support.google.com/googleplay/android-developer/answer/12463044)\nto redirect them to specific journeys or features when relevant.\n\nAll Instant play games must support automatic\n[sign-in using Google Play Games Services](https://developers.google.com/games/services/common/concepts/sign-in). Use\nGoogle Play Games Services to\nprovide a consistent player ID that you can use to restore saved progress\nfrom the cloud.\n\nSize impact of the library\n\nThe size impact of the Google Play Games Services library depends on whether the\ngame engine runs on Unity, Java, or Native.\n\nJava\n\nThe size impact is minimal because ProGuard is informed about\nwhich classes are used.\n\nUnity\n\nYou can integrate the game save feature into your Unity game using the\n[official Google Play Game Services plugin](https://github.com/playgameservices/play-games-plugin-for-unity/tree/master/current-build).\nThe size impact is around 200 KB if you use the ProGuard recommendations.\n\nNative\n\nYou can integrate the game save feature with a game built on the Android NDK using the\n[Native Play Games Services SDK](https://developers.google.com/games/services/cpp/GettingStartedNativeClient).\n\nUse the general ProGuard configuration below to strip out most of the Java code\nincluded by the library. You can implement Play Games Services\nsign-in and game save with this configuration, while only adding about\n250 KB to the APK. \n\n # The native PGS library wraps the Java PGS SDK using reflection.\n -dontobfuscate\n -keeppackagenames\n\n # Needed for callbacks.\n -keepclasseswithmembernames,includedescriptorclasses class * {\n native \u003cmethods\u003e;\n }\n\n # Needed for helper libraries.\n -keep class com.google.example.games.juihelper.** {\n public protected *;\n }\n -keep class com.sample.helper.** {\n public protected *;\n }\n\n # Needed for GoogleApiClient and auth stuff.\n -keep class com.google.android.gms.common.api.** {\n public protected *;\n }\n\n # Keep all of the \"nearby\" library, which is needed by the native PGS library\n # at runtime (though deprecated).\n -keep class com.google.android.gms.nearby.** {\n public protected *;\n }\n\n # Keep all of the public PGS APIs.\n -keep class com.google.android.gms.games.** {\n public protected *;\n }"]]