05/15/2024 15:19:45

Google Channel Description

I. Overview

I. Overview

1.1 Google Mobile Services and Google Play Services

GMS is short for Google Mobile Services

Google Play Services is a set of Google system services on Android cellphones, including: OAuth (authorization system), Games (game service), Ads (advertising service), Maps (map service), etc.

GMS is generally thought as the abbreviation of Google Play Services

1.2 Google Play Games application

Google Play Games is GMS's gaming application that is used to manage the user's Google game information and provide achievements and leaderboard functions, similar to iOS GameCenter. MSDK Google login relies on Google Game services, which requires the Google Play Games application must be installed on the cellphone

II. Developer platform Configuration

II. Developer Platform Configuration

The main process for the configuration of Google developer platform is as follows:

  • Enter Google Play console, create an app
  • Create game service, used to associate API console ; otherwise, it will return a 10002 error. Associate the app created above
  • API console Configure the backend permission to specify which Google services the app can use

2.1 Register A Developer Account

Please follow the Google guidelines to apply for such an account

It's needed to note that Google will charge a fee of US$25. Please prepare your credit card in advance.

2.2 Create Game App

Enter Google Play console , and create game service

Supplement information (the minimum requirement is to supplement all the content with the " √ " on the left side)

2.3 Create A Game Service

In the game service menu, create a new game service

Fill in the basic information

Supplement the game service information (the minimum requirement is to supplement all the content with the " √ " on the left side)

2.4 Associate Game Service and App

Add Android app association

If the game app has been created, you can find the corresponding app here to associate

2.5 Add Google Play Tester

Before the game is released, only testers can login it, and confirm that the app is in a testable state

2.6 Backend API Configuration

In "Game Details", find the corresponding Api console link, and click to jump

  • Confirm API

    Make sure the Google game service API is available

  • Create OAuth

    In the credential menu, add OAuth client

    It is needed to add Android and Web types. Android is used for mobile terminal login, and Web is used for MSDK server to get user information

    Agree the agreement

    Create Android client, where Software package name and Signature certificate fingerprint can be confirmed by contacting the development team. Android OAuth needs to configure the SHA1 and package name of KeyStore. The two values ​​need to be correct; otherwise, the login process will appear exception

    Create the webpage client with the same method

    After this is completed, the mobile terminal contains an Android client and a web client:

    • Android client is used for client login
    • Web client is used for MSDK to get offline authorization. The client ID is Server client ID. The "Download" button on the far right provides the download file to MSDK

    • Add test permission

      In the IAM menu, add testers and their permissions

2.7 Configure Achievements and Leaderboard

According to the game's needs, you can find the menu function of adding achievements and leaderboards in the game service.

2.8 Provide Open Beta Test for Games. Games Can Be Posted to Google Play

The benefits of publishing a beta test are: Users can download games on Google Play and have no permission to add comments and can only reflect problems via the configured channels. Click on "Manage BETA version" in the below diagram and follow the prompts to fill in the corresponding content.

2.9 Feiying configuration

In the game details page > login information of Feiying system, check the Google Play channel and fill in the AppID and AppKey

AppID is the Web client ID (Server Client ID) in the OAuth operation established in 2.6 background API configurations, and AppKey is the Web client key

III. Android Project Configuration

III. Android Project Configuration

3.1 Permission Configuration

In AndroidManifest.xml, add network access permissions

  <uses-permission android:name="android.permission.INTERNET"/>

3.2 Google Game APP ID Version Configuration

In Application node, add the following configuration:

  <meta-data
        android:name="com.google.android.gms.games.APP_ID"
        android:value="@string/msdk_google_app_id" />

[info] Where, msdk_google_app_id is gotten when Game Service is configured in Google Play Console

3.3 App ID Configuration and Server Client ID Configuration

In the project's assets/MSDKConfig.ini file, add the following configurations

[Google channel configuration ]
GOOGLE_APP_ID = {YOUR_GOOGLE_APP_ID}
MSDK_GOOGLE_CLIENT_KEY = {YOUR_GOOGLE_CLIENT_KEY}

[info] Where, ID needs to be replaced with the app ID of the game:

  1. {YOUR_GOOGLE_APP_ID} is the APP_ID of the game in Google Play Console, namely the APP_ID configured in 3.2
  2. {YOUR_GOOGLE_CLIENT_KEY} is Web client Key required by MSDK and is obtained when configuring API OAuth
  3. The last three configuration items are optional and can be configured only as required.
IV. iOS Project Configuration

IV. iOS Project Configuration

Google Play Console Address Credentials has various data which need to be accessed. Take Demo for example:

4.1 Needed data

  • Client ID: The account ID applied for iOS. This value needs to be filled in: GOOGLE_CLIENT_KEY_IOS field in MSDKConfig.ini.
  • Server ID: The server's ID. This value needs to be filled in: GOOGLE_CLIENT_KEY field in MSDKConfig.ini (If your game has accessed Android before, this value should be the same as Android's)

4.2 Configure

After updating Google's plugin package and SDK, pay attention to configuring the project file:

  • Add the following items in dependent frameworks:
LocalAuthentication.framework
SafariServices.framework
SystemConfiguration.framework
  • Add -ObjC in ObjC linker flag:
Other Linker Flags: $(OTHER_LDFLAGS) -ObjC
  • Add ClientID in URL scheme, such as:

V. Function Description

V. Function Description

5.1 Login Function

  1. Quick login logic description

    Google login differs from regular login. It needs to connect to a Google service first.

    So in the case of quick login, there will be failure to connect to Google. You need to pay attention to MSDK error code 9999

  2. Instructions about Google Login

MSDK will determine whether the Google mobile service (GMS) is available before making a Google login. Only when GMS is valid, the corresponding login service can be called. If GMS is invalid, the error code returned by Google will be returned to the game via the thirdCode field of MSDKLoginRet.

Return code Corresponding value Error description
SERVICE_MISSING 1 GMS is missing on the device
SERVICE_VERSION_UPDATE_REQUIRED 2 The installed GMS version has expired
SERVICE_DISABLED 3 GMS is disabled
SERVICE_INVALID 9 The installed GMS version is incorrect
SERVICE_UPDATING 18 GMS is being updated on the device

[info] Refer to Google Docs: https://developers.google.com/android/reference/com/google/android/gms/common/ConnectionResult.html

5.2 Google Game Service

  1. First setup and then use

    Game is a separate module. It is needed to call the Setup method even if Google login module is used. Demo code:

     MSDKGame.Setup  ("Google", "");
    
  2. Account consistency description

    Google game service (achievements and leaderboard) reporting corresponds to the connected Google service. In the general case:

    • After Google is connected successfully, call Game module's Setup method. Achievements will be reported to the login account
    • In case of non-Google login, you can also use Game module's functions. Achievements will be reported to the currently connected Google account
  3. Focus on UI closure callback

    The Game module's ShowLeaderBoard and ShowAchievement interfaces will open the UI, and the user can log out in the "..." configuration in the upper right corner of the UI. This can cause the achievements system to be unavailable. At this point, you need to call the Setup method again.

VI. FAQs

VI. FAQs

6.1 Configure Exception Crash

The following Crash occurs when App ID and Server Client Key are not configured properly

  Caused by: java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
    at com.google.android.gms.common.internal.zzf$zza.zzb (Unknown Source) 
    at com.google.android.gms.common.internal.zzf$zza.zzu (Unknown Source) 
    at com.google.android.gms.common.internal.zzf$zze.zzxH (Unknown Source) 
    at com.google.android.gms.common.internal.zzf$zzd.handleMessage (Unknown Source) 
    ...

6.2 Description of GMS Upgrade and Version Compatibility

Earlier different versions of Google Play Services cannot be mixed and there are version compatibility issues among them. The current GMS version used by MSDK is 16.0.0 and the Firebase version is 16.0.5

[danger] Precautions Please contact us for confirmation before upgrading GMS

6.3 DEVELOPER_ERROR Error

GOOGLE_CLIENT_KEY is Web Client Key required by MSDK Note that you should not use Android Client Key here, otherwise there will be a DEVELOPER_ERROR error; meanwhile, you also need to confirm that the signature used during debugging is consistent with the application signature uploaded to Google console.



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""