Skip to main content

Aggregated Login UI

Overview

This provides a ready-to-use login UI that displays the supported login platforms configured for your game app in SGS App Data Center.

The UI is available in both light and dark modes.

aggregated_login_ui aggregated_login_ui_dark

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-ui:$msdk_version"
// implementation other login platform modules
}

Usage

Display aggregated login UI

AggregatedLoginManager aggregatedLoginManager = new AggregatedLoginManager(activity);
aggregatedLoginManager.setOnLoginListener(/*listener instance*/this);
aggregatedLoginManager.showDialog(ThemeType.Light, new AggregatedLoginParams(
List.of(
new GarenaLoginParams(...), // // You can pass in the platform-specific login parameters here.
),
));

Customize the button order.

aggregatedLoginManager.showDialog(ThemeType.Light, new AggregatedLoginParams(
List.of(
new GarenaLoginParams(...), // // You can pass in the platform-specific login parameters here.
),
List.of(
LoginPlatform.GOOGLE, LoginPlatform.FACEBOOK, LoginPlatform.GUEST
)
));

Customize your own login UI by getting available login platformsList

AccountManager accountManager = new AccountManager(activity);
accountManager.getAvailableLoginPlatforms(result->{
if(result.isSuccess()) {
List<Integer> platforms = result.unwrap();
// render your login UI
} else {
MSDKError error = result.getErrorInfo();
// request failed, maybe you should ask the user to try again?
}
});