Gamebase SDK for Android  2.41.1
NHN Cloud Gamebase Platform
Gamebase Class Reference

This class is a wrapper class that is provided to use various features of Gamebase platform. More...

Collaboration diagram for Gamebase:
Collaboration graph

Classes

class  Analytics
 
class  Contact
 This class provides wrapping of function execution related to TOAST Contact. More...
 
class  ImageNotice
 This class provides functionality related to image notices. More...
 
class  Launching
 This class is provided to check information such as launch information, status, and so on. More...
 
class  Logger
 
class  Network
 This class provides network status information. More...
 
class  Purchase
 This class provides wrapping of function execution related to payment. More...
 
class  Push
 This class provides wrapping of function execution related to push notification. More...
 
class  TemporaryWithdrawal
 This class provides functionality related to temporary withdrawal. More...
 
class  Terms
 This class provides functionality related to terms of use view. More...
 
class  Util
 This class provides Android utility functions. More...
 
class  WebView
 This class implements the Webview call function. More...
 

Static Public Member Functions

static void activeApp (final Context applicationContext)
 Notifies the Gamebase SDK that the app has launched. More...
 
static void initialize (final Activity activity, final GamebaseConfiguration configuration, @Nullable final GamebaseDataCallback< LaunchingInfo > callback)
 This function initializes the Gamebase SDK. More...
 
static boolean isInitialized ()
 Check whether the Gamebase is initialized. More...
 
static boolean isSuccess (@Nullable final GamebaseException exception)
 Returns true if the GamebaseException object is null or the error code is zero. More...
 
static boolean isDebugMode ()
 Indicates if we are in debug mode. More...
 
static void setDebugMode (boolean enableDebug)
 Used to enable or disable logging, and other debug features. More...
 
static String getSDKVersion ()
 Returns the current version of the Gamebase SDK for Android as a string. More...
 
static boolean isSandbox ()
 Returns whether this project is sandbox mode or not. More...
 
static void login (@NonNull final Activity activity, final String providerName, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Logs the user in with the external authentication provider. More...
 
static void login (@NonNull final Activity activity, final String providerName, @Nullable Map< String, Object > additionalInfo, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Logs the user in with the external authentication provider. More...
 
static void login (@NonNull final Activity activity, @NonNull final Map< String, Object > credentialInfo, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Logs the user in with the credential of external authentication provider. More...
 
static void loginForLastLoggedInProvider (@NonNull final Activity activity, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Logs the user in with last logged in authentication provider. More...
 
static void addMapping (@NonNull final Activity activity, @NonNull final String providerName, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Mapping the currently authenticated user identifier of Gamebase with another external authentication. More...
 
static void addMapping (@NonNull final Activity activity, @NonNull final String providerName, @Nullable final Map< String, Object > additionalInfo, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Mapping the currently authenticated user identifier of Gamebase with another external authentication. More...
 
static void addMapping (@NonNull final Activity activity, @NonNull final Map< String, Object > credentialInfo, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Mapping the currently authenticated user identifier of Gamebase with the credential of external authentication provider. More...
 
static void changeLogin (@NonNull final Activity activity, @NonNull final ForcingMappingTicket forcingMappingTicket, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Change logged in account with ForcingMappingTicket. More...
 
static void addMappingForcibly (@NonNull final Activity activity, @NonNull final ForcingMappingTicket forcingMappingTicket, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider. More...
 
static void addMappingForcibly (@NonNull final Activity activity, @NonNull final String providerName, @NonNull final String forcingMappingKey, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider. More...
 
static void addMappingForcibly (@NonNull final Activity activity, @NonNull final String providerName, @NonNull final String forcingMappingKey, @Nullable final Map< String, Object > additionalInfo, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider. More...
 
static void addMappingForcibly (@NonNull final Activity activity, @NonNull final Map< String, Object > credentialInfo, @NonNull final String forcingMappingKey, @Nullable final GamebaseDataCallback< AuthToken > callback)
 Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider. More...
 
static void removeMapping (@NonNull final Activity activity, @NonNull final String providerName, @Nullable final GamebaseCallback callback)
 Removes external authentication that is mapped to the current user identifier. More...
 
static void logout (@NonNull final Activity activity, @Nullable final GamebaseCallback callback)
 Logs out the user. More...
 
static void withdraw (@NonNull final Activity activity, @Nullable final GamebaseCallback callback)
 Withdraws the user. More...
 
static void queryTransferAccount (final GamebaseDataCallback< TransferAccountInfo > callback)
 Try to query the transfer account to Gamebase. More...
 
static void issueTransferAccount (final GamebaseDataCallback< TransferAccountInfo > callback)
 Try to issue the transfer account. More...
 
static void renewTransferAccount (final TransferAccountRenewConfiguration configuration, final GamebaseDataCallback< TransferAccountInfo > callback)
 Try to renew the transfer account. More...
 
static void transferAccountWithIdPLogin (final String accountId, final String accountPassword, final GamebaseDataCallback< AuthToken > callback)
 Try to transfer account with transfer account id and password. More...
 
static String getUserID ()
 Gets the user ID that is currently logged in. More...
 
static String getAccessToken ()
 Gets the access token for the current user. More...
 
static String getLastLoggedInProvider ()
 Gets the name of the last logged-in authentication provider. More...
 
static List< String > getAuthMappingList ()
 Gets the list of external authentication providers mapped to the current user identifier. More...
 
static String getAuthProviderUserID (@NonNull String providerName)
 Gets the user ID from the authentication provider. More...
 
static String getAuthProviderAccessToken (@NonNull String providerName)
 Gets the access token from the authentication provider. More...
 
static AuthProviderProfile getAuthProviderProfile (@NonNull String providerName)
 Gets the profile from the authentication provider. More...
 
static BanInfo getBanInfo ()
 Gets the ban information of the suspended user. More...
 
static String getDeviceLanguageCode ()
 Gets the language code set for the current device. More...
 
static String getDisplayLanguageCode ()
 Gets the display language code set for the current device. More...
 
static void setDisplayLanguageCode (String displayLanguageCode)
 
static String getCarrierCode ()
 Gets the carrier code set for the current device. More...
 
static String getCarrierName ()
 Gets the carrier name set for the current device. More...
 
static String getCountryCode ()
 Gets the country code. More...
 
static String getCountryCodeOfUSIM ()
 Gets the country code set in USIM. More...
 
static String getCountryCodeOfDevice ()
 Gets the country code currently set on the device. More...
 
static void onActivityResult (int requestCode, int resultCode, Intent data)
 The method that should be called from the Activity's or Fragment's onActivityResult method. More...
 
static void addEventHandler (GamebaseEventHandler handler)
 Add a Gamebase event handler to be called when every events are arrived. More...
 
static void removeEventHandler (GamebaseEventHandler handler)
 Remove a Gamebase event listener. More...
 
static void removeAllEventHandler ()
 Remove all Gamebase event listeners. More...
 
static void addServerPushEvent (ServerPushEvent event)
 Add a server push event listener to be called when server push message is arrived. More...
 
static void removeServerPushEvent (ServerPushEvent event)
 Remove a server push event listener. More...
 
static void removeAllServerPushEvent ()
 Remove all server push event listeners. More...
 
static void addObserver (Observer observer)
 Add a observer to be called when network status, launching status or user status is changed. More...
 
static void removeObserver (Observer observer)
 Remove a observer listener. More...
 
static void removeAllObserver ()
 Remove all observer listeners. More...
 

Detailed Description

This class is a wrapper class that is provided to use various features of Gamebase platform.

Provides functions such as authentication, launching, pushing, and billing.

Member Function Documentation

◆ activeApp()

static void activeApp ( final Context  applicationContext)
static

Notifies the Gamebase SDK that the app has launched.

It should be called as early as possible.

Because of release 2.6.0, GamebaseInitProvider call the API automatically, You do not need to call the API.

Since
Added 1.4.0.
Deprecated:
As of release 2.6.0, This is called by the GamebaseInitProvider automatically.
Parameters
applicationContextThe application context.
Exceptions
NullPointerException'applicationContext' is null.
IllegalStateException'android.permission.INTERNET' permission is not defined in AndroidManifest.xml

Example Usage:

public class GamebaseApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Gamebase.activeApp(getApplicationContext());
}
}

◆ addEventHandler()

static void addEventHandler ( GamebaseEventHandler  handler)
static

Add a Gamebase event handler to be called when every events are arrived.

You have to convert the message data to VO below according to the category value.
GamebaseEventCategory.LOGGED_OUT : GamebaseEventLoggedOutData GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT_MESSAGE_RECEIVED : GamebaseEventServerPushData GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT : GamebaseEventServerPushData GamebaseEventCategory.SERVER_PUSH_TRANSFER_KICKOUT : GamebaseEventServerPushData GamebaseEventCategory.OBSERVER_LAUNCHING : GamebaseEventObserverData GamebaseEventCategory.OBSERVER_HEARTBEAT : GamebaseEventObserverData GamebaseEventCategory.OBSERVER_NETWORK : GamebaseEventObserverData GamebaseEventCategory.PURCHASE_UPDATED : PurchasableReceipt GamebaseEventCategory.PUSH_RECEIVED_MESSAGE : PushMessage GamebaseEventCategory.PUSH_CLICK_MESSAGE : PushMessage GamebaseEventCategory.PUSH_CLICK_ACTION : PushAction
LOGGED_OUT : This event is fired when the Gamebase Access Token expires and the user is logged out. SERVER_PUSH : Receive messages from the Gamebase server. OBSERVER : This is an event that fires when the launch, login account(hearbeat), or network connection 'status changes'. PURCHASE_UPDATED : Promotion payment events can be received. PUSH_RECEIVED_MESSAGE : This event operates when a Push message is received. It has a 'isForeground' boolean value in the extras field. PUSH_CLICK_MESSAGE : This event is executed when the Push message is clicked. Note that there is no 'isForeground' boolean value. PUSH_CLICK_ACTION : This is an event that is triggered when the action button added through the rich message function is clicked.

Since
Added 2.10.0
Parameters
handlerThe listener that will run.

Example Usage:

public static void addGamebaseEventHandler(Activity activity) {
Gamebase.addEventHandler(new GamebaseEventHandler() {
@Override
public void onReceive(@NonNull GamebaseEventMessage message) {
switch (message.category) {
case GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT:
case GamebaseEventCategory.SERVER_PUSH_TRANSFER_KICKOUT:
GamebaseEventServerPushData serverPushData = GamebaseEventServerPushData.from(message.data);
if (serverPushData != null) {
processServerPush(activity, message.category, serverPushData);
}
break;
case GamebaseEventCategory.OBSERVER_LAUNCHING:
case GamebaseEventCategory.OBSERVER_HEARTBEAT:
case GamebaseEventCategory.OBSERVER_NETWORK:
GamebaseEventObserverData observerData = GamebaseEventObserverData.from(message.data);
if (observerData != null) {
processObserver(activity, message.category, observerData);
}
break;
case GamebaseEventCategory.PURCHASE_UPDATED:
PurchasableReceipt receipt = PurchasableReceipt.from(message.data);
if (receipt != null) {
// If the user got item by 'Promotion Code',
// this event will be occurred.
}
break;
case GamebaseEventCategory.PUSH_RECEIVED_MESSAGE:
PushMessage pushMessage = PushMessage.from(message.data);
if (pushMessage != null) {
// When you received push message.
try {
JSONObject json = new JSONObject(pushMessage.extras);
// There is 'isForeground' information.
boolean isForeground = json.getBoolean("isForeground");
Object customValue = json.get("YourCustomKey");
} catch (Exception e) {}
}
break;
case GamebaseEventCategory.PUSH_CLICK_MESSAGE:
PushMessage clickedMessage = PushMessage.from(message.data);
if (clickedMessage != null) {
// When you clicked push message.
}
break;
case GamebaseEventCategory.PUSH_CLICK_ACTION:
PushAction pushAction = PushAction.from(message.data);
if (pushAction != null) {
// When you clicked action button by 'Rich Message'.
}
break;
default:
break;
}
}
});
}
void processServerPush(String category,
GamebaseEventServerPushData data) {
if (category.equals(GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT)) {
// Kicked out from Gamebase server.(Maintenance, banned or etc..)
// Return to title and initialize Gamebase again.
} else if (category.equals(GamebaseEventCategory.SERVER_PUSH_TRANSFER_KICKOUT)) {
// If the user wants to move the guest account to another device,
// if the account transfer is successful,
// the login of the previous device is released,
// so go back to the title and try to log in again.
}
}
void processObserver(String category,
GamebaseEventObserverData data) {
if (category.equals(GamebaseEventCategory.OBSERVER_LAUNCHING)) {
int launchingStatusCode = data.code;
String launchingMessage = data.message;
switch (launchingStatusCode) {
case LaunchingStatus.IN_SERVICE:
// Finished maintenance.
break;
case LaunchingStatus.INSPECTING_SERVICE:
case LaunchingStatus.INSPECTING_ALL_SERVICES:
// Under maintenance.
break;
...
}
} else if (category.equals(GamebaseEventCategory.OBSERVER_HEARTBEAT)) {
int errorCode = data.code;
switch (errorCode) {
case GamebaseError.INVALID_MEMBER:
// You can check the invalid user session in here.
// ex) After transferred account to another device.
break;
case GamebaseError.BANNED_MEMBER:
// You can check the banned user session in here.
break;
}
} else if (category.equals(GamebaseEventCategory.OBSERVER_NETWORK)) {
int networkTypeCode = data.code;
// You can check the changed network status in here.
if (networkTypeCode == NetworkManager.TYPE_NOT) {
// Network disconnected.
} else {
// Network connected.
}
}
}
See also
com.toast.android.gamebase.event.GamebaseEventHandler.
com.toast.android.gamebase.event.data.GamebaseEventMessage.
com.toast.android.gamebase.event.data.GamebaseEventServerPushData.
com.toast.android.gamebase.event.data.GamebaseEventObserverData.
com.toast.android.gamebase.base.purchase.PurchasableReceipt.
com.toast.android.gamebase.event.data.PushMessage.
com.toast.android.gamebase.event.data.PushAction.

◆ addMapping() [1/3]

static void addMapping ( @NonNull final Activity  activity,
@NonNull final Map< String, Object >  credentialInfo,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Mapping the currently authenticated user identifier of Gamebase with the credential of external authentication provider.

Since
Added 1.4.0.
Parameters
activityThe activity which is starting the login process.
credentialInfoThe credentialInfo which is credential of authentication provider.
callbackMapping result callback,
returns the authentication token as a result of mapping.

Example Usage:

Map<String, Object> credential = new HashMap<>();
credential.put(AuthProviderCredentialConstants.PROVIDER_NAME, providerName);
credential.put(AuthProviderCredentialConstants.ACCESS_TOKEN, accessToken);
credential.put(AuthProviderCredentialConstants.ACCESS_TOKEN_SECRET, accessTokenSecret);
Gamebase.addMapping(activity, credential, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException exception) {
if (Gamebase.isSuccess(exception)) {
Log.d(TAG, "Add mapping successful");
...
} else {
Log.e(TAG, "Add mapping failed");
...
}
}
});
See also
com.toast.android.gamebase.base.auth.AuthProvider.
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.

◆ addMapping() [2/3]

static void addMapping ( @NonNull final Activity  activity,
@NonNull final String  providerName,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Mapping the currently authenticated user identifier of Gamebase with another external authentication.

Since
Added 1.4.0.
Parameters
activityThe activity which is starting the mapping process.
providerNameThe providerName which is authentication provider.
callbackMapping result callback,
returns the authentication token as a result of mapping.

Example Usage:

Gamebase.addMapping(activity, AuthProvider.GOOGLE, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException exception) {
if (Gamebase.isSuccess(exception)) {
Log.d(TAG, "Add mapping successful");
...
} else {
Log.e(TAG, "Add mapping failed");
...
}
}
});
See also
com.toast.android.gamebase.base.auth.AuthProvider.
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMapping() [3/3]

static void addMapping ( @NonNull final Activity  activity,
@NonNull final String  providerName,
@Nullable final Map< String, Object >  additionalInfo,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Mapping the currently authenticated user identifier of Gamebase with another external authentication.

Since
Added 1.4.0.
Parameters
activityThe activity which is starting the mapping process.
providerNameThe providerName which is authentication provider.
additionalInfoThe additionalInfo which is additional information using for mapping.
callbackCallbacks the results of mappings,
returns the authentication token as a result of mappings.

Example Usage:

Gamebase.addMapping(activity, AuthProvider.GOOGLE, null, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException exception) {
if (Gamebase.isSuccess(exception)) {
Log.d(TAG, "Add mapping successful");
...
} else {
Log.e(TAG, "Add mapping failed");
...
}
}
});
See also
com.toast.android.gamebase.base.auth.AuthProvider.
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.

◆ addMappingForcibly() [1/4]

static void addMappingForcibly ( @NonNull final Activity  activity,
@NonNull final ForcingMappingTicket  forcingMappingTicket,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider.

Parameters
activityThe activity which is starting the login process.
forcingMappingTicketThe mapping information which is necessary to map forcibly with the provider that is already mappped with another account.
callbackResume mapping result callback,
returns the authentication token as a result of mapping.

Example Usage:

public void addMappingForciblyFacebook(final Activity activity) {
Gamebase.addMapping(activity, AuthProvider.FACEBOOK, null, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken result, GamebaseException exception) {
// Add Mapping Success.
if (Gamebase.isSuccess(exception)) {
...
}
// If you got this error code(AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) that means this user already has another account of the idP.
// You can call this method, Gamebase.addMappingForcibly() which can try to map forcibly with the idP.
if (exception.getCode() == GamebaseError.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) {
// Before calling the mapping forcibly api, You should get this ForcingMappingTicket for this method parameter.
final ForcingMappingTicket ticket = ForcingMappingTicket.from(exception);
// Try to add mapping forcibly with the ForcingMappingTicket.
Gamebase.addMappingForcibly(activity, ticket, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException addMappingForciblyException) {
if (Gamebase.isSuccess(addMappingForciblyException)) {
// Add Mapping Forcibly Success.
Log.d(TAG, "Add Mapping Forcibly successful");
String userId = Gamebase.getUserID();
return;
}
// Add Mapping Forcibly Failed.
// Check the error code and handle the error appropriately.
...
}
}
} else {
// Add Mapping Failed.
// Check the error code and handle the error appropriately.
...
}
}
});
}
See also
com.toast.android.gamebase.Gamebase#addMapping(Activity, String, Map, GamebaseDataCallback)
com.toast.android.gamebase.auth.mapping.data.ForcingMappingTicket
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.
Here is the caller graph for this function:

◆ addMappingForcibly() [2/4]

static void addMappingForcibly ( @NonNull final Activity  activity,
@NonNull final Map< String, Object >  credentialInfo,
@NonNull final String  forcingMappingKey,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider.

Parameters
activityThe activity which is starting the login process.
credentialInfoThe credentialInfo which is credential of authentication provider.
forcingMappingKeyThe key string which is necessary to map forcibly with the provider that is already mappped with another account.
callbackMapping Forcibly result callback,
returns the authentication token as a result of mapping.

Example Usage:

public void addMappingForciblyFacebook(final Activity activity, final String facebookAccessToken) {
final Map<String, Object> credentialInfo = new HashMap<>();
credentialInfo.put(AuthProviderCredentialConstants.PROVIDER_NAME, AuthProvider.FACEBOOK);
credentialInfo.put(AuthProviderCredentialConstants.ACCESS_TOKEN, facebookAccessToken);
Gamebase.addMapping(activity, credentialInfo, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken result, GamebaseException exception) {
// Add Mapping Success.
if (Gamebase.isSuccess(exception)) {
...
}
// If you got this error code(AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) that means this user already has another account of the AuthProvider.XXX),
// You can call this method, Gamebase.addMappingForcibly() which can try to map forcibly with the AuthProvider.XXX.
if (exception.getCode() == GamebaseError.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) {
// Before calling the mapping forcibly api, You should get this ForcingMappingTicket and ForcingMappingKey string for this method parameter.
final ForcingMappingTicket ticket = ForcingMappingTicket.from(exception);
final String forcingMappingKey = ticket.forcingMappingKey;
// Try to add mapping forcibly with the ForcingMappingKey.
Gamebase.addMappingForcibly(activity, credentialInfo, forcingMappingKey, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException addMappingForciblyException) {
if (Gamebase.isSuccess(addMappingForciblyException)) {
// Add Mapping Forcibly Success.
Log.d(TAG, "Add Mapping Forcibly successful");
String userId = Gamebase.getUserID();
return;
}
// Add Mapping Forcibly Failed.
// Check the error code and handle the error appropriately.
...
}
}
} else {
// Add Mapping Failed.
// Check the error code and handle the error appropriately.
...
}
}
});
}
See also
com.toast.android.gamebase.Gamebase#addMapping(Activity, String, Map, GamebaseDataCallback)
com.toast.android.gamebase.auth.mapping.data.ForcingMappingTicket
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.

◆ addMappingForcibly() [3/4]

static void addMappingForcibly ( @NonNull final Activity  activity,
@NonNull final String  providerName,
@NonNull final String  forcingMappingKey,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider.

Parameters
activityThe activity which is starting the login process.
providerNameThe providerName which is authentication provider.
forcingMappingKeyThe key string which is necessary to map forcibly with the provider that is already mappped with another account.
callbackMapping Forcibly result callback,
returns the authentication token as a result of mapping.

Example Usage:

public void addMappingForciblyFacebook(final Activity activity) {
Gamebase.addMapping(activity, AuthProvider.FACEBOOK, null, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken result, GamebaseException exception) {
// Add Mapping Success.
if (Gamebase.isSuccess(exception)) {
...
}
// If you got this error code(AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) that means this user already has another account of the AuthProvider.XXX),
// You can call this method, Gamebase.addMappingForcibly() which can try to map forcibly with the AuthProvider.XXX.
if (exception.getCode() == GamebaseError.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) {
// Before calling the mapping forcibly api, You should get this ForcingMappingTicket and ForcingMappingKey string for this method parameter.
final ForcingMappingTicket ticket = ForcingMappingTicket.from(exception);
final String forcingMappingKey = ticket.forcingMappingKey;
// Try to add mapping forcibly with the ForcingMappingKey.
Gamebase.addMappingForcibly(activity, AuthProvider.FACEBOOK, forcingMappingKey, null, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException addMappingForciblyException) {
if (Gamebase.isSuccess(addMappingForciblyException)) {
// Add Mapping Forcibly Success.
Log.d(TAG, "Add Mapping Forcibly successful");
String userId = Gamebase.getUserID();
return;
}
// Add Mapping Forcibly Failed.
// Check the error code and handle the error appropriately.
...
}
}
} else {
// Add Mapping Failed.
// Check the error code and handle the error appropriately.
...
}
}
});
}
See also
com.toast.android.gamebase.Gamebase#addMapping(Activity, String, Map, GamebaseDataCallback)
com.toast.android.gamebase.auth.mapping.data.ForcingMappingTicket
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.
Here is the call graph for this function:

◆ addMappingForcibly() [4/4]

static void addMappingForcibly ( @NonNull final Activity  activity,
@NonNull final String  providerName,
@NonNull final String  forcingMappingKey,
@Nullable final Map< String, Object >  additionalInfo,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Forcibly trying to map the currently authenticated user identifier of Gamebase with the credential of external authentication provider.

Parameters
activityThe activity which is starting the login process.
providerNameThe providerName which is authentication provider.
forcingMappingKeyThe key string which is necessary to map forcibly with the provider that is already mappped with another account.
additionalInfoThe additionalInfo which is additional information using for mapping.
callbackMapping Forcibly result callback,
returns the authentication token as a result of mapping.

Example Usage:

public void addMappingForciblyFacebook(final Activity activity, final Map<String, Object> additionalInfo) {
Gamebase.addMapping(activity, AuthProvider.FACEBOOK, additionalInfo, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken result, GamebaseException exception) {
// Add Mapping Success.
if (Gamebase.isSuccess(exception)) {
...
}
// If you got this error code(AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) that means this user already has another account of the AuthProvider.XXX),
// You can call this method, Gamebase.addMappingForcibly() which can try to map forcibly with the AuthProvider.XXX.
if (exception.getCode() == GamebaseError.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) {
// Before calling the mapping forcibly api, You should get this ForcingMappingTicket and ForcingMappingKey string for this method parameter.
final ForcingMappingTicket ticket = ForcingMappingTicket.from(exception);
final String forcingMappingKey = ticket.forcingMappingKey;
// Try to add mapping forcibly with the ForcingMappingKey.
Gamebase.addMappingForcibly(activity, AuthProvider.FACEBOOK, forcingMappingKey, additionalInfo, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException addMappingForciblyException) {
if (Gamebase.isSuccess(addMappingForciblyException)) {
// Add Mapping Forcibly Success.
Log.d(TAG, "Add Mapping Forcibly successful");
String userId = Gamebase.getUserID();
return;
}
// Add Mapping Forcibly Failed.
// Check the error code and handle the error appropriately.
...
}
}
} else {
// Add Mapping Failed.
// Check the error code and handle the error appropriately.
...
}
}
});
}
See also
com.toast.android.gamebase.Gamebase#addMapping(Activity, String, Map, GamebaseDataCallback)
com.toast.android.gamebase.auth.mapping.data.ForcingMappingTicket
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.

◆ addObserver()

static void addObserver ( Observer  observer)
static

Add a observer to be called when network status, launching status or user status is changed.

Since
Added 1.8.0.
Parameters
observerThe callback that will run.

Example Usage:

public class MyObserverManager {
...
private void handlingObserverMessage() {
Gamebase.addObserver(new Observer() {
@Override
public void onLaunchingInfoUpdate(ObserverMessage message) {
String typeOfMessage = message.type;
Map<String, Object> dataMap = message.data;
if (typeOfMessage.equalsIgnoreCase(ObserverMessage.Type.LAUNCHING)) {
int code = (int) dataMap.get("code");
String messageString = (String) dataMap.get("message");
Log.d(TAG, "Update launching status: " + code + ", " + messageString);
} else if (typeOfMessage.equalsIgnoreCase(ObserverMessage.Type.HEARTBEAT)) {
Log.d(TAG, "Heartbeat changing : " + dataMap);
} else if (typeOfMessage.equalsIgnoreCase(ObserverMessage.Type.NETWORK)) {
Log.d(TAG, "Network changing : " + dataMap);
} else {
Logger.d(TAG, "Something gonna be changing : " + dataMap);
}
}
});
}
...
}
See also
com.toast.android.gamebase.observer.Observer.

◆ addServerPushEvent()

static void addServerPushEvent ( ServerPushEvent  event)
static

Add a server push event listener to be called when server push message is arrived.

Since
Added 1.8.0.
Parameters
eventThe callback that will run.

Example Usage:

public class MyServerPushEventManager {
...
private void handlingServerPushMessage() {
Gamebase.addServerPushEvent(new ServerPushEvent() {
@Override
public void onReceive(ServerPushEventMessage message) {
if (message.type.equals(ServerPushEventMessage.Type.APP_KICKOUT)) {
Gamebase.logout(activity, new GamebaseCallback() {
@Override
public void onCallback(GamebaseException exception) {
MyGameManager.logoutAndReLaunching();
}
});
} else {
...
}
}
});
}
...
}
See also
com.toast.android.gamebase.serverpush.ServerPushEvent.

◆ changeLogin()

static void changeLogin ( @NonNull final Activity  activity,
@NonNull final ForcingMappingTicket  forcingMappingTicket,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Change logged in account with ForcingMappingTicket.

Parameters
activityThe activity which is starting the login process.
forcingMappingTicketThe mapping information which is necessary to log in another account.
callbackResume mapping result callback,
returns the authentication token as a result of mapping.

Example Usage:

public void changeLoginFacebook(final Activity activity) {
Gamebase.addMapping(activity, AuthProvider.FACEBOOK, null, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken result, GamebaseException exception) {
// Add Mapping Success.
if (Gamebase.isSuccess(exception)) {
...
}
// If you got this error code(AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) that means this user already has another account of the idP.
// You can call this method, Gamebase.changeLogin(ForcingMappingTicket) which can change the log in account.
if (exception.getCode() == GamebaseError.AUTH_ADD_MAPPING_ALREADY_MAPPED_TO_OTHER_MEMBER) {
// Before calling the change login api, You should get this ForcingMappingTicket for this method parameter.
final ForcingMappingTicket ticket = ForcingMappingTicket.from(exception);
// Try to change log in account with the ForcingMappingTicket.
Gamebase.changeLogin(activity, ticket, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException changeLoginException) {
if (Gamebase.isSuccess(changeLoginException)) {
// Log in account changed successfully.
Log.d(TAG, "Change login successful");
String userId = Gamebase.getUserID();
return;
}
// Change login failed.
// The UserID will not changed.
...
}
}
} else {
// Add Mapping Failed.
// Check the error code and handle the error appropriately.
...
}
}
});
}
See also
com.toast.android.gamebase.Gamebase#addMapping(Activity, String, Map, GamebaseDataCallback)
com.toast.android.gamebase.auth.mapping.data.ForcingMappingTicket
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.

◆ getAccessToken()

static String getAccessToken ( )
static

Gets the access token for the current user.

Since
Added 1.4.0.
Returns
The access token for Gamebase platform.

◆ getAuthMappingList()

static List<String> getAuthMappingList ( )
static

Gets the list of external authentication providers mapped to the current user identifier.

Since
Added 1.4.0.
Returns
The list of external authentication providers mapped to the current user identifier.
See also
com.toast.android.gamebase.base.auth.AuthProvider.

◆ getAuthProviderAccessToken()

static String getAuthProviderAccessToken ( @NonNull String  providerName)
static

Gets the access token from the authentication provider.

Since
Added 1.4.0.
Parameters
providerNameThe providerName which is authentication provider.
Returns
The access token from the authentication provider.

◆ getAuthProviderProfile()

static AuthProviderProfile getAuthProviderProfile ( @NonNull String  providerName)
static

Gets the profile from the authentication provider.

Since
Added 1.4.0.
Parameters
providerNameThe providerName which is authentication provider.
Returns
The profile from the authentication provider.

◆ getAuthProviderUserID()

static String getAuthProviderUserID ( @NonNull String  providerName)
static

Gets the user ID from the authentication provider.

Since
Added 1.4.0.
Parameters
providerNameThe providerName which is authentication provider.
Returns
The user ID from the authentication provider.

◆ getBanInfo()

static BanInfo getBanInfo ( )
static

Gets the ban information of the suspended user.

Since
Added 1.11.0.
Returns
The ban information of the suspended user.

◆ getCarrierCode()

static String getCarrierCode ( )
static

Gets the carrier code set for the current device.

Since
Added 1.4.0.
Returns
The carrier code set for the current device.
Here is the call graph for this function:

◆ getCarrierName()

static String getCarrierName ( )
static

Gets the carrier name set for the current device.

Since
Added 1.4.0.
Returns
The carrier name set for the current device.
Here is the call graph for this function:

◆ getCountryCode()

static String getCountryCode ( )
static

Gets the country code.

First, get the country code set in USIM,
and if there is no USIM, get the country code set in the device.

Since
Added 1.4.0.
Returns
The country code.
Here is the call graph for this function:

◆ getCountryCodeOfDevice()

static String getCountryCodeOfDevice ( )
static

Gets the country code currently set on the device.

Since
Added 1.4.0.
Returns
The country code currently set on the device.
Here is the call graph for this function:

◆ getCountryCodeOfUSIM()

static String getCountryCodeOfUSIM ( )
static

Gets the country code set in USIM.

Since
Added 1.4.0.
Returns
The country code that is set in USIM.
Here is the call graph for this function:

◆ getDeviceLanguageCode()

static String getDeviceLanguageCode ( )
static

Gets the language code set for the current device.

Since
Added 1.5.1.
Returns
The device language code that is currently set.
Here is the call graph for this function:

◆ getDisplayLanguageCode()

static String getDisplayLanguageCode ( )
static

Gets the display language code set for the current device.

Since
Added 1.5.1.
Returns
The display language code that is currently set.

◆ getLastLoggedInProvider()

static String getLastLoggedInProvider ( )
static

Gets the name of the last logged-in authentication provider.

Since
Added 1.4.0.
Returns
The name that is last logged-in authentication provider.
See also
com.toast.android.gamebase.base.auth.AuthProvider.

◆ getSDKVersion()

static String getSDKVersion ( )
static

Returns the current version of the Gamebase SDK for Android as a string.

Since
Added 1.4.0.
Returns
The current version of the Gamebase SDK.
Here is the call graph for this function:

◆ getUserID()

static String getUserID ( )
static

Gets the user ID that is currently logged in.

Since
Added 1.4.0.
Returns
The user id that is currently logged in.

◆ initialize()

static void initialize ( final Activity  activity,
final GamebaseConfiguration  configuration,
@Nullable final GamebaseDataCallback< LaunchingInfo callback 
)
static

This function initializes the Gamebase SDK.

If this function is not called, the Gamebase SDK function will not work.

Since
Added 1.4.0.
Parameters
activityThe activity which is initializing modules.
configurationThe configurations required to run the Gamebase SDK.
callbackInitialization result callback,
returns the launching information as a result of initialization.

Example Usage:

public class SampleActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
Gamebase.setDebugMode(true);
GamebaseConfiguration initSettings = GamebaseConfiguration.newBuilder(
"diIofWef", "1.0.0", PurchaseProvider.StoreCode.GOOGLE)
.build();
Gamebase.initialize(activity, initSettings, new GamebaseDataCallback<LaunchingInfo>() {
@Override
public void onCallback(LaunchingInfo data, GamebaseException exception) {
if (Gamebase.isSuccess(exception)) {
// Success
...
} else {
// Failed
...
}
}
});
}
...
}
See also
com.toast.android.gamebase.GamebaseConfiguration.
com.toast.android.gamebase.launching.data.LaunchingInfo.
com.toast.android.gamebase.GamebaseDataCallback.

◆ isDebugMode()

static boolean isDebugMode ( )
static

Indicates if we are in debug mode.

Since
Added 1.4.0.
Returns
True if enabled debug, false if not.

◆ isInitialized()

static boolean isInitialized ( )
static

Check whether the Gamebase is initialized.

Since
Added 1.4.0.
Returns
True if initialized, false otherwise.

◆ isSandbox()

static boolean isSandbox ( )
static

Returns whether this project is sandbox mode or not.

Since
Added 1.4.0.
Returns
Boolean value whether this project is sandbox mode.

◆ isSuccess()

static boolean isSuccess ( @Nullable final GamebaseException  exception)
static

Returns true if the GamebaseException object is null or the error code is zero.

Since
Added 1.4.0.
Parameters
exceptionThe exception that occurred.
Returns
True if success, false if not.
Here is the call graph for this function:

◆ issueTransferAccount()

static void issueTransferAccount ( final GamebaseDataCallback< TransferAccountInfo callback)
static

Try to issue the transfer account.

Since
Added 2.1.0.
Parameters
callback
See also
TransferAccountInfo
public static void onIssueTransferAccount(final Activity activity) {
Gamebase.issueTransferAccount(new GamebaseDataCallback<TransferAccountInfo>() {
@Override
public void onCallback(final TransferAccountInfo transferAccount, final GamebaseException exception) {
if (!Gamebase.isSuccess(exception)) {
// Issuing TransferAccount failed.
return;
}
// Issuing TransferAccount success.
final String account = transferAccount.account.id;
final String password = transferAccount.account.password;
}
});
}

◆ login() [1/3]

static void login ( @NonNull final Activity  activity,
@NonNull final Map< String, Object >  credentialInfo,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Logs the user in with the credential of external authentication provider.

Since
Added 1.4.0.
Parameters
activityThe activity which is starting the login process.
credentialInfoThe credentialInfo which is credential of authentication provider.
callbackLogin result callback,
returns the authentication token as a result of login.

Example Usage:

Map<String, Object> credential = new HashMap<>();
credential.put(AuthProviderCredentialConstants.PROVIDER_NAME, providerName);
credential.put(AuthProviderCredentialConstants.ACCESS_TOKEN, accessToken);
credential.put(AuthProviderCredentialConstants.ACCESS_TOKEN_SECRET, accessTokenSecret);
Gamebase.login(activity, credential, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException exception) {
if (Gamebase.isSuccess(exception)) {
Log.d(TAG, "Login successful");
...
} else {
Log.e(TAG, "Login failed");
...
}
}
});
See also
com.toast.android.gamebase.base.auth.AuthProvider.
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.

◆ login() [2/3]

static void login ( @NonNull final Activity  activity,
final String  providerName,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Logs the user in with the external authentication provider.

Since
Added 1.4.0.
Parameters
activityThe activity which is starting the login process.
providerNameThe provider name witch is authentication provider.
callbackLogin result callback,
returns the authentication token as a result of login.

Example Usage:

Gamebase.login(activity, AuthProvider.GOOGLE, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException exception) {
if (Gamebase.isSuccess(exception)) {
Log.d(TAG, "Login successful");
...
} else {
Log.e(TAG, "Login failed");
...
}
}
});
See also
com.toast.android.gamebase.base.auth.AuthProvider.
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ login() [3/3]

static void login ( @NonNull final Activity  activity,
final String  providerName,
@Nullable Map< String, Object >  additionalInfo,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Logs the user in with the external authentication provider.

Since
Added 1.4.0.
Parameters
activityThe activity which is starting the login process.
providerNameThe providerName which is authentication provider.
additionalInfoThe additionalInfo which is additional information using for login.
callbackLogin result callback,
returns the authentication token as a result of login.

Example Usage:

Gamebase.login(activity, AuthProvider.GOOGLE, additionalInfo, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException exception) {
if (Gamebase.isSuccess(exception)) {
Log.d(TAG, "Login successful");
...
} else {
Log.e(TAG, "Login failed");
...
}
}
});
See also
com.toast.android.gamebase.base.auth.AuthProvider.
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.

◆ loginForLastLoggedInProvider()

static void loginForLastLoggedInProvider ( @NonNull final Activity  activity,
@Nullable final GamebaseDataCallback< AuthToken callback 
)
static

Logs the user in with last logged in authentication provider.

Since
Added 1.4.0.
Parameters
activityThe activity which is starting the mapping process.
callbackLogin result callback,
returns the authentication token as a result of login.

Example Usage:

Gamebase.loginForLastLoggedInProvider(new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException exception) {
if (Gamebase.isSuccess(exception)) {
Log.d(TAG, "Login successful");
...
} else {
Log.e(TAG, "Login failed");
...
}
}
});
See also
com.toast.android.gamebase.auth.data.AuthToken.
com.toast.android.gamebase.GamebaseDataCallback.

◆ logout()

static void logout ( @NonNull final Activity  activity,
@Nullable final GamebaseCallback  callback 
)
static

Logs out the user.

Since
Added 1.4.0.
Parameters
activityThe activity which is starting the mapping process.
callbackCallbacks the result of logout.

Example Usage:

public static void testLogout() {
Gamebase.logout(activity, new GamebaseCallback() {
@Override
public void onCallback(final GamebaseException exception) {
if (!Gamebase.isSuccess(exception)) {
// Logout failed.
return;
}
// Logout success.
}
});
}
See also
com.toast.android.gamebase.GamebaseCallback.

◆ onActivityResult()

static void onActivityResult ( int  requestCode,
int  resultCode,
Intent  data 
)
static

The method that should be called from the Activity's or Fragment's onActivityResult method.

Since
Added 1.4.0.
Parameters
requestCodeThe request code that's received by the Activity or Fragment.
resultCodeThe result code that's received by the Activity or Fragment.
dataThe result data that's received by the Activity or Fragment.

Example Usage:

public class MainActivity extends AppCompatActivity {
...
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Gamebase.onActivityResult(requestCode, resultCode, data);
}
...
}

◆ queryTransferAccount()

static void queryTransferAccount ( final GamebaseDataCallback< TransferAccountInfo callback)
static

Try to query the transfer account to Gamebase.

If the transfer account is already issued, it returns.

Since
Added 2.1.0.
Parameters
callback
See also
TransferAccountInfo
public static void onQueryTransferAccount(final Activity activity) {
Gamebase.queryTransferAccount(new GamebaseDataCallback<TransferAccountInfo>() {
@Override
public void onCallback(final TransferAccountInfo transferAccount, final GamebaseException exception) {
if (!Gamebase.isSuccess(exception)) {
// Querying TransferAccount failed.
return;
}
// Querying TransferAccount success.
final String account = transferAccount.account.id;
final String password = transferAccount.account.password;
}
});
}

◆ removeAllEventHandler()

static void removeAllEventHandler ( )
static

Remove all Gamebase event listeners.

Since
Added 2.10.0.

◆ removeAllObserver()

static void removeAllObserver ( )
static

Remove all observer listeners.

Since
Added 1.8.0.

◆ removeAllServerPushEvent()

static void removeAllServerPushEvent ( )
static

Remove all server push event listeners.

Since
Added 1.8.0.

◆ removeEventHandler()

static void removeEventHandler ( GamebaseEventHandler  handler)
static

Remove a Gamebase event listener.

Since
Added 2.10.0.
Parameters
handlerThe listener that will be removed.
See also
com.toast.android.gamebase.event.GamebaseEventHandler.
com.toast.android.gamebase.event.data.GamebaseEventMessage.

◆ removeMapping()

static void removeMapping ( @NonNull final Activity  activity,
@NonNull final String  providerName,
@Nullable final GamebaseCallback  callback 
)
static

Removes external authentication that is mapped to the current user identifier.

Since
Added 1.4.0.
Parameters
activityThe activity which is starting the mapping process.
providerNameThe providerName which is authentication provider.
callbackCallbacks the result of removing the mapping.

Example Usage:

Gamebase.removeMapping(AuthProvider.GOOGLE, new GamebaseCallback() {
@Override
public void onCallback(GamebaseException exception) {
if (Gamebase.isSuccess(exception)) {
Log.d(TAG, "Remove mapping successful");
} else {
Log.d(TAG, "Remove mapping failed");
}
}
});
See also
com.toast.android.gamebase.base.auth.AuthProvider.
com.toast.android.gamebase.GamebaseCallback.

◆ removeObserver()

static void removeObserver ( Observer  observer)
static

Remove a observer listener.

Since
Added 1.8.0.
Parameters
observerThe callback that will be removed.
See also
com.toast.android.gamebase.observer.Observer.

◆ removeServerPushEvent()

static void removeServerPushEvent ( ServerPushEvent  event)
static

Remove a server push event listener.

Since
Added 1.8.0.
Parameters
eventThe callback that will be removed.
See also
com.toast.android.gamebase.serverpush.ServerPushEvent.

◆ renewTransferAccount()

static void renewTransferAccount ( final TransferAccountRenewConfiguration  configuration,
final GamebaseDataCallback< TransferAccountInfo callback 
)
static

Try to renew the transfer account.

If you want to renew the account automatically or manually, you should pass the proper TransferAccountRenewConfiguration object to the first parameter.

Since
Added 2.1.0.
Parameters
configuration
callback
See also
TransferAccountRenewConfiguration
TransferAccountInfo
public static void onRenewTransferAccount(final Activity activity) {
final RenewalTargetType renewalTargetType = RenewalTargetType.ID_PASSWORD;
final TransferAccountRenewConfiguration autoConfig = TransferAccountRenewConfiguration.newAutoRenewConfiguration(renewalTargetType);
final TransferAccountRenewConfiguration manualConfig = TransferAccountRenewConfiguration.newManualRenewConfiguration("id", "password");
Gamebase.renewTransferAccount(autoConfig, new GamebaseDataCallback<TransferAccountInfo>() {
@Override
public void onCallback(final TransferAccountInfo transferAccountInfo, final GamebaseException exception) {
if (!Gamebase.isSuccess(exception)) {
// Renewing TransferAccount failed.
return;
}
// Renewing TransferAccount success.
final String renewedAccount = transferAccount.account.id;
final String renewedPassword = transferAccount.account.password;
}
});
}

◆ setDebugMode()

static void setDebugMode ( boolean  enableDebug)
static

Used to enable or disable logging, and other debug features.

If true, Outputs a log when the log priority is VERBOSE or higher.
If false, Outputs a log when the log priority is WARN or higher.

Since
Added 1.4.0.
Parameters
enableDebugDebug features (like logging) are enabled if true, disabled if false.

◆ setDisplayLanguageCode()

static void setDisplayLanguageCode ( String  displayLanguageCode)
static

◆ transferAccountWithIdPLogin()

static void transferAccountWithIdPLogin ( final String  accountId,
final String  accountPassword,
final GamebaseDataCallback< AuthToken callback 
)
static

Try to transfer account with transfer account id and password.

If this process is finished successfully, it proceeds login process and return AuthToken.

Since
Added 2.1.0.
Parameters
accountId
accountPassword
callback
See also
TransferAccountInfo#account
AuthToken
public static void onTransferAccount(final Activity activity, final String accountId, final String accountPassword) {
Gamebase.transferAccountWithIdPLogin(accountId, accountPassword, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(final AuthToken authToken, final GamebaseException exception) {
if (!Gamebase.isSuccess(exception)) {
// Transfering Account failed.
return;
}
// Transfering Account success.
// TODO: implements post login process
}
});
}

◆ withdraw()

static void withdraw ( @NonNull final Activity  activity,
@Nullable final GamebaseCallback  callback 
)
static

Withdraws the user.

Since
Added 1.4.0.
Parameters
activityThe activity which is starting the mapping process.
callbackCallbacks the result of withdraw.

Example Usage:

public static void testWithdraw() {
Gamebase.withdraw(activity, new GamebaseCallback() {
@Override
public void onCallback(final GamebaseException exception) {
if (!Gamebase.isSuccess(exception)) {
// Withdraw failed.
return;
}
// Withdraw success.
}
});
}
See also
com.toast.android.gamebase.GamebaseCallback.
Here is the caller graph for this function:
com.toast.android.gamebase.Gamebase.onActivityResult
static void onActivityResult(int requestCode, int resultCode, Intent data)
The method that should be called from the Activity's or Fragment's onActivityResult method.
Definition: Gamebase.java:1190