Skip to main content

Login via Google

Prerequisite

Create an Android credential from Google Cloud Console and get the Client ID

google_cloud_android_credential.jpg

Create a Web credential from Google Cloud Console and get the Client ID/Client secret

google_cloud_web_credential.jpg

Configure these client ids and client secret above to Garena Open Platform console

gop_credentials.jpg

Add dependencies

Add the following code in build.gradle on the app-level, and replace $msdk_version with the actual MSDK version.

dependencies {
implementation "com.garena.sdk.android:login-google:$msdk_version"
}

Configuration

Configure AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

...

<application ...>

<meta-data
android:name="com.garena.sdk.google_client_id"
android:value="[google_client_id]" />
....
</application>

</manifest>

Usage

AccountManager accountManager = new AccountManager(activity);
accountManager.login(PlatformType.GOOGLE, onLoginListener);