Skip to main content

Android

The purpose of this article is to explain how to set up Google Authentication so that your game can be logged in through the Google channel using the Player Network login authentication service.

Prerequisites

1. Set up your game in the Google Play admin center
note

For the IEGG project, please contact [miaruan (Ruan Mingjun)] for Google Apps registration and configuration.

1. Create Google Apps

Follow the prompts to register an account on Google Play Console.

info

Google charges a $25 service fee.Please have your credit card ready in advance.

  1. Go to Google Play Console.
  2. On the All apps page, click Create app to create the game app.
    Image - create a game app
  3. Enter the application information.
    Image - enter information for the app
2. Configuring the Play game service

Set up the Play game service to manage game metadata and automate game production and distribution tasks.

  1. Go to Google Play Console.
  2. In the left navigation bar, select Grow users > Play Games Services > Setup and management > Configuration.
  3. Under Which Play Games Services project do you want to use, select the corresponding option to create a Play Games Services project. Image service creation
  4. In the Properties section, click Edit Properties.
  5. Enter the basic information about the game and click Save changes. Image basic game information
3. add a credential that connects the OAuth 2.0 client ID to the game
  1. Go to Google Cloud Platform.
  2. In the left navigation bar, click OAuth consent screen.
  3. Follow the instructions to set up the OAuth consent screen.
    Image, consent to the agreement
  4. Click Clients on the left navigation bar.
  5. On the Clients page, select CREATE CLIENT > Create OAuth Client ID to create an OAuth client ID.
    Image, create OAuth clientsI
  6. In the Application type list, click Android.
  7. Enter Package Name and SHA-1 Certificate Fingerprint.
    Confirm Package Name and SHA-1 Certificate Fingerprint with the development team.The OAuth client for Android requires the user to configure the SHA-1 certificate fingerprint and package name in the KeyStore.Make sure these two values are correct.Otherwise, the login process will be abnormal.
    Image, create an Android client
  8. Click SAVE to complete the configuration.
  9. Go to the details page of the Android app to view the Customer ID and Customer Secret.
  10. Click Audience > ADD USERS to add a login test user.
    Image, add test users
4. Adding game testers
  1. Go to Google Play Console.
  2. In the left navigation bar, select Grow users > Play Games Services > Setup and management > Testers.
  3. In the Testers tab, click Add testers to add testers to your game.
    Image testers
note

Until the game app is released, only testers can log in.Make sure the application is in a test state.

5. Configuring achievements and leaderboards

Find the Achievements and Leaderboards features under the Play Game Services menu and configure them as needed.

Image leaderboard

6. Get Google API ID

Access the Info Center from the Google Cloud Platform panel.The Google API ID is the Project No. on this page.

Image ID

7. Get the Client ID and Client secret.

Follow the steps in Add credentials to link OAuth 2.0 client IDs to the game to get application information.

Image Web Client ID and Secret

  1. Obtain Player Network Console login account.
  2. Create a new project for your game, or join an existing one.
  3. Download SDK.
  4. Integrate the SDK.
  5. Add Google as a business login authentication method in the Player Network console.

Step 1:Configure SDK for Google Sign-in

  1. In the AndroidManifest file, make sure the required permissions are added.Google needs access to the web.
<uses-permission android:name="android.permission.INTERNET"/>
  1. Open your project's INTLConfig.ini file:
INTLConfig.ini
[INTL environment]
# WARNING: You should change this URL to the production environment when you release your game.
INTL_URL = https://test.intlgame.com
GAME_ID = {INTL_GAME_ID}
SDK_KEY = {INTL_SDK_KEY}
[INTL Log]
LOG_LEVEL = 1
LOG_CONSOLE_OUTPUT_ENABLE = 1
LOG_FILE_OUTPUT_ENABLE = 1
LOG_ENCRYPT_ENABLE = 0
LOG_COMPRESS_ENABLE = 0
[Android LifeCycle]
LIFECYCLE = Google
[Google]
GOOGLE_CLIENT_KEY_ANDROID = {INTL_GOOGLE_CLIENT_KEY}
  • Set the SDK backend environment to INTL_URL = https://test.intlgame.com.
  • Replace {INTL_GAME_ID} and {INTL_SDK_KEY} with the GAME_ID and SDK_KEY values assigned by the Player Network console.
  • Set LOG_LEVEL = 1, LOG_CONSOLE_OUTPUT_ENABLE = 1, LOG_FILE_OUTPUT_ENABLE = 1, LOG_ENCRYPT_ENABLE = 0 and LOG_COMPRESS_ENABLE = 0 to output console logs and log files without encrypting or compressing the output without encrypting or compressing the output.
  • Add Google to LIFECYCLE.For more information, please see SDK Environment.
  • Replace {INTL_GOOGLE_CLIENT_KEY} with Web Client Key.
    This is the client ID of the web application in the Credentials section of the API OAuth configuration process, also referred to as the Server Client ID in the API OAuth 2.5 configuration process.
  1. Define manifestPlaceholders in the gradle file, replacing {INTL_GOOGLE_APP_ID} with Google App ID.
mainTemplate.gradle
android {
defaultConfig {
manifestPlaceholders = ["GOOGLE_APPID":"{INTL_GOOGLE_APP_ID}"]
}
}

Step 2: Add Google Login

All Google actions require a connection to Google services.

AuthLogin

During automatic sign-in, the device may not be able to connect to Google services.It is therefore recommended to let Player Network SDK connect to Google services during automatic login by default.(Game teams can disable this connection by configuring the GOOGLE_LOGOUT_NEED_CONNECT field in the Google Channel Configuration section of the INTLConfig configuration file.)

Login

Before calling Google Login, the Player Network SDK checks to see if Google Mobile Services (GMS) is available.The login service can only be invoked when GMS is available.If GMS is not available, the Player Network SDK will return the error code sent by Google to the game via the ThirdCode field of INTLAuthResult.

Return CodeReturn valuemisdescription
SERVICE_MISSING1GMS is not available on the device.
SERVICE_VERSION_UPDATE_REQUIRED2The installed version of GMS is out of date.
SERVICE_DISABLED3GMS is disabled.
SERVICE_INVALID9The version of GMS installed is incorrect.
SERVICE_UPDATING18The GMS on the device is being updated.

For more information, see Google Docs and Google Frequently Asked Questions

  1. Register login-related callbacks.
// Add callbacks
public void AddAuthObserver()
{
INTLAPI.AddAuthResultObserver(OnAuthResultEvent);
}

// Remove callbacks
public void RemoveAuthObserver()
{
INTLAPI.RemoveAuthResultObserver(OnAuthResultEvent);
}

// Process the INTLAuthResult callback
public void OnAuthResultEvent(INTLAuthResult AuthResult)
{
Debug.Log($"MethodID: {AuthResult.MethodId}");

string methodTag = "";
switch (AuthResult.MethodId)
{
case (int)INTLMethodID.INTL_AUTH_LOGIN:
methodTag = "Login";
break;
case (int)INTLMethodID.INTL_AUTH_BIND:
methodTag = "Bind";
break;
case (int)INTLMethodID.INTL_AUTH_AUTOLOGIN:
methodTag = "AutoLogin";
break;
case (int)INTLMethodID.INTL_AUTH_QUERY_USER_INFO:
methodTag = "QueryUserInfo";
break;
case (int)INTLMethodID.INTL_AUTH_GET_AUTH_RESULT:
methodTag = "GetAuthResult";
break;
}
}
  1. Call the AutoLogin interface to log in automatically.
INTLAPI.AutoLogin();
  1. If automatic login fails, call the Login interface to let the player log in manually.
INTLAPI.Login(INTLChannel.Google); 
  1. Synchronize client authentication status with the game backend and wait for the final verification result.

[Optional] Set email permission

To get the player's email when logging in to Google, you need to set the corresponding permission, which will return email in the ChannelInfo of AuthResult.

  • For compliance considerations, masking of returned email for specific origins can be done. Please contact Player Network Assistant to enable it if needed.
  • In the background log, you can report the hash of base64(sha256(email)). Contact Player Network Assistant if needed.
  • Can be used to verify whether the player's information or the binding list contains email information. Contact Player Network Assistant if needed.

Enable the email return feature in the Player Network Console by setting return_email to YES. For details, see Third-Party Channel Configuration.

Step 3: Acceptance testing for login functionality

Search for the keyword "AuthResult" in the Player Network SDK logs to confirm whether the channel name and OpenID are returned correctly.If correct, it means the integration configuration is successful, and login functionality has been successfully added.

If you encounter problems during the integration process, please refer to Frequently Asked Questions.

Step 4: Publish the game

Before you are ready to release the official version, create a test version using Android App Bundle.

The nice thing about releasing Beta is that users can download it from Google play, but don't have access to add comments.Specific channels are set up for users to submit feedback.

Creating official releases
  1. Go to Google Play Console.

  2. In the left navigation bar, select Release > Production.

    Figure: Select corresponding channel

  3. Follow the instructions to create a production version.

Image beta testing

Changing the Publishing Status
caution

Authentication may fail if the user does not release the application.

  1. Go to the OAuth consent interface page for Google Cloud Platform (https://console.cloud.google.com/apis/credentials/consent).
  2. Change PUBLISHING STATUS to PUBLISH APP.

Image app release

Testing Google Login with APK

For more information, see Testing Google Sign-in with APKs.

Synchronized login state using Google Play Games Services

Google Play Games Services (GooglePGS) enables PGS sign-in, cross-device login state synchronization, and access to PGS features such as achievements.It is recommended for games that need to sync login state between Android devices and the Google Play Games for PC emulator, or that want to use PGS achievements.

Integrating GooglePGS requires the INTLGooglePGS plugin.While GooglePGS works with any login channel, it is typically used alongside INTLGoogle — the cross-device sync feature is designed for the Google ecosystem, where both the Android device and the Google Play Games for PC emulator share the same Google account.

Step 1: Configuring the SDK for GooglePGS

  1. Add the following configuration in the INTLConfig.ini file:

    INTLConfig.ini
    [Android LifeCycle]
    LIFECYCLE = GooglePGS
    [GooglePGS]
    GOOGLEPGS_SERVER_PROJECT_ID = {INTL_GOOGLEPGS_SERVER_PROJECT_ID}
    GOOGLEPGS_ENABLE_PGS = 1
    GOOGLEPGS_ENABLE_SYNC = 0
    • Replace {INTL_GOOGLEPGS_SERVER_PROJECT_ID} with the Web client key.
      This is the client ID of the web application in the Credentials section of the API OAuth configuration process, also referred to as the server client ID in the API OAuth 2.5 configuration process.
    • GOOGLEPGS_ENABLE_PGS controls whether the client-side PGS flow is enabled, including PGS initialization, login, and the welcome bubble.Set GOOGLEPGS_ENABLE_PGS = 1 to enable.
note

Starting from V1.31, GOOGLEPGS_ENABLE_PGS only controls the client-side PGS flow.The backend sync behavior is now controlled separately by GOOGLEPGS_ENABLE_SYNC.

  • GOOGLEPGS_ENABLE_SYNC controls whether the SDK syncs the player's OpenID with their PGS Player ID on the Player Network backend.This binding enables cross-device auto-login via PGS — when a player logs in on Device A, Device B can automatically find the associated OpenID through the PGS Player ID.Set GOOGLEPGS_ENABLE_SYNC = 1 to enable. Default is 0 (disabled).
tip

If your game does not need cross-device login recovery via PGS, you can leave GOOGLEPGS_ENABLE_SYNC = 0.This is the recommended setting for games that do not have an independent PGS channel configured in the Player Network Console.

  1. Define manifestPlaceholders in the gradle file, replacing {INTL_GOOGLEPGS_APPID} with the Google App ID.
mainTemplate.gradle
android {
defaultConfig {
manifestPlaceholders = ["GOOGLEPGS_APPID":"{INTL_GOOGLEPGS_APPID}"]
}
}

Step 2: On Google Play Games for PC, use AutoLogin to get the login state

After a player has logged in on an Android device (via any channel such as Google), you can sync the login state to the Google Play Games for Pc emulator via GooglePGS.Both the Android device and the PC emulator must be login to the same Google account.

note

This step requires GOOGLEPGS_ENABLE_SYNC = 1 in Step 1.Without it, the OpenID–PGS Player ID binding is never created, and cross-device auto-login will not work.

INTLAPI.AutoLogin();

[Optional] Step 3: Manually trigger PGS Login

After a successful login through another channel (e.g., Google), the SDK automatically triggers a non-force PGS sign-in in the background.In this automatic flow, the SDK initializes PGS and shows the PGS welcome popup. It then checks the player's PGS authentication state:

  • If already authenticated: The SDK proceeds to request a server-side auth code for PGS identity binding.
  • If not authenticated: The SDK silently skips PGS login without showing the sign-in UI to the player.
note

On the very first app launch on a device with a Google account, PGS v2 may display a login or profile creation prompt as part of its own platform onboarding.This is triggered by PGS initialization (PlayGamesSdk.initialize()), not by the SDK's signIn() call, and is outside the SDK's control.On subsequent launches, PGS either silently authenticates (if the player previously completed login) or remains unauthenticated without showing any UI.If there is no Google account on the device, this prompt does not appear even on the first launch.

If you need to explicitly trigger PGS login from the game side (for example, to let the player link their PGS identity), you can call the ActivatePGSService API.Unlike the automatic flow, this is a force login call.This API is Android only.When called, the SDK will:

  1. Run pre-checks: verify that GOOGLEPGS_ENABLE_PGS = 1, the activity is valid, and Google Play Services is available.If any check fails, an error is returned through the auth result callback.
  2. Initialize PGS and check if the player is already authenticated with PGS:
    • If already authenticated: The SDK proceeds to request a server-side auth code for PGS identity binding.
    • If not authenticated: Because this is a force login call, the SDK invokes signIn() which presents the Google PGS sign-in UI to the player.If the player completes login successfully, the SDK proceeds to request the auth code.If the player dismisses the UI or login fails, an error is returned through the auth result callback.
INTLAPI.ActivatePGSService();

GooglePGS Configuration Reference

ConfigurationDefault valueDescription
GOOGLEPGS_SERVER_PROJECT_IDWeb client ID (server client ID) from Google Cloud Console OAuth credentials.Required.
GOOGLEPGS_ENABLE_PGS0Enables the client-side PGS flow (initialization, login, welcome bubble).
GOOGLEPGS_ENABLE_SYNC0Syncs the player's OpenID with their PGS Player ID on the Player Network backend for cross-device auto-login.

Google PGS Achievements

The Player Network SDK provides an Achievement module that integrates with Google Play Games Services achievement feature.This allows games to unlock achievements, increment progress, and display the native achievements UI.

info

The Achievement module currently supports Android (GooglePGS) only.Support for iOS, Windows, and other achievement services will be provided in subsequent versions.

Prerequisites

  1. Complete the GooglePGS configuration above with GOOGLEPGS_ENABLE_PGS = 1.
  2. Configure achievements in the Google Play Console under Play Games Services > Setup and management > Achievements.
  3. PGS must be authenticated before calling any achievement API.The SDK automatically authenticates PGS after a successful login when GOOGLEPGS_ENABLE_PGS = 1, or you can manually trigger it via ActivatePGSService.

Step 1: Register the Achievement Observer

Register a callback to receive achievement operation results.

// Add achievement callback
INTLAPI.AddAchievementResultObserver(OnAchievementResult);

// Remove achievement callback
INTLAPI.RemoveAchievementResultObserver(OnAchievementResult);

// Handle achievement result
public void OnAchievementResult(INTLAchievementResult ret)
{
Debug.Log($"Achievement MethodID: {ret.MethodId}, RetCode: {ret.RetCode}");
}

Step 2: Unlock achievement

Unlock a standard (non-incremental) achievement by its ID.

INTLAPI.UnlockAchievement("GooglePGS", "achievement_id_here");

Step 3: Increment achievement progress

For incremental achievements, increment the progress by a specified number of steps.

INTLAPI.IncrementAchievement("GooglePGS", "achievement_id_here", 1);

Step 4: Display achievements UI

Display the native Google Play Games achievements overlay.

INTLAPI.ShowAchievementsUI("GooglePGS");

Achievement API Reference

APIParametersDescription
UnlockAchievementchannel, achievementId, extraJson (optional)Unlock a standard achievement.
IncrementAchievementchannel, achievementId, numSteps, extraJson (optional)Increments progress of an incremental achievement.
ShowAchievementsUIchannel, extraJson (optional)Displays the native achievements UI overlay.
AddAchievementResultObserverCallbackRegisters a callback for achievement results.
RemoveAchievementResultObserverCallbackRemoves a previously registered achievement callback.

Achievement Result Data

The INTLAchievementResult (Unity) / FINTLAchievementResult (UE) contains:

FieldTypeDescription
MethodIdintThe method that triggered this result (2701=Unlock, 2702=Increment, 2703=ShowUI).
RetCodeintResult code.0 indicates success.
SubRetCodeintSecondary result code (available since V1.28).
RetMsgstringResult message.
ThirdCodeintPlatform-specific error code.11002 = NOT_AUTHENTICATED (PGS not signed in).
ThirdMsgstringMessage returned from external platform.
ExtraJsonstringReserved field (JSON format).
PlatformstringThe achievement provider name, e.g., "GooglePGS".
SeqIdstringSequence ID for the request.
AchievementListlistList of AchievementInfo objects.See note below.
note

For the current GooglePGS implementation, AchievementList is always empty for all achievement operations (UnlockAchievement, IncrementAchievement, ShowAchievementsUI).This field can be safely ignored.It may be populated in future SDK versions when additional achievement query features is added — this applies to the achievement module across all channels, not just GooglePGS.A null check (if (achievementRet.AchievementList != null)) is the recommended defensive pattern.

Each AchievementInfo contains:

FieldTypeDescription
AchievementIdstringThe achievement identifier.
NamestringThe achievement display name.
DescriptionstringThe achievement description.
CurrentStepsintCurrent progress (for incremental achievements).
TotalStepsintTotal steps required (for incremental achievements).
StatusintAchievement status (unlocked / in progress).
UnlockTimeintTimestamp when the achievement was unlocked.