The second Android 11 Developer Preview is now available, test it out and share your feedback.

Support Google Play Games Services

Automatic sign-in using Google Play Games Services is required for all Instant play games. Using Google Play Games Services ensures that users are able to sign-in seamlessly and provides a consistent player id that you should use to restore saved game progress from the cloud.

Size impact of the library

The size impact of the Google Play Games Services library depends on whether the game engine runs on Java, Native, or Unity.

Java

The size impact should be fairly negligible since ProGuard has good insight into which classes are actually used.

Unity

If you want to integrate game save into your Unity game, you can use the official Google Play Game Services plugin. The size impact will be minimal, around 200kb if the ProGuard recommendations are used.

Native

If you want to integrate game save with a game built on the NDK, use the Native Play Games Services SDK.

Use the general ProGuard configuration below to strip out most of the Java code included by the library. Using this config, you should be able to implement Play Games Services sign-in and game save while only adding about 250KB to the APK.

# 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 *;
}