Gamebase SDK for Android  2.39.0
NHN Cloud Gamebase Platform
Gamebase.TemporaryWithdrawal Class Reference

This class provides functionality related to temporary withdrawal. More...

Collaboration diagram for Gamebase.TemporaryWithdrawal:
Collaboration graph

Static Public Member Functions

static void requestWithdrawal (@NonNull Activity activity, @Nullable GamebaseDataCallback< TemporaryWithdrawalInfo > callback)
 Request to withdraw. More...
 
static void cancelWithdrawal (@NonNull Activity activity, @Nullable GamebaseCallback callback)
 If the user has requested to withdraw, cancel it. More...
 
static void withdrawImmediately (@NonNull Activity activity, @Nullable GamebaseCallback callback)
 This function ignores the withdrawal grace period and proceeds withdrawal immediately. More...
 

Detailed Description

This class provides functionality related to temporary withdrawal.

Member Function Documentation

◆ cancelWithdrawal()

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

If the user has requested to withdraw, cancel it.


If the user has never requested to leave, the function call will fail.

Since
Added 2.9.0.
Parameters
activityThe activity which is starting the mapping process.
callbackCallbacks the result of cancel withdrawal.

Example Usage:

public static void testCancelWithdraw() {
Gamebase.TemporaryWithdrawal.cancelWithdrawal(new GamebaseCallback() {
@Override
public void onCallback(final GamebaseException exception) {
if (!Gamebase.isSuccess(exception)) {
if (exception.getCode() == GamebaseError.AUTH_WITHDRAW_NOT_TEMPORARY_WITHDRAW) {
// Never requested temporary withdrawal before.
} else {
// Cancel temporary withdrawal failed.
return;
}
}
// Cancel temporary withdrawal success.
}
});
}
See also
com.toast.android.gamebase.GamebaseCallback.

◆ requestWithdrawal()

static void requestWithdrawal ( @NonNull Activity  activity,
@Nullable GamebaseDataCallback< TemporaryWithdrawalInfo callback 
)
static

Request to withdraw.


If the user who requested the withdrawal logs in, you can check the grace expiration time through the AuthToken.getTemporaryWithdrawalInfo().getGracePeriodDate().

Since
Added 2.9.0.
Parameters
activityThe activity which is starting the mapping process.
callbackCallbacks the result of requesting withdrawal.

Example Usage:

// Request withdrawal
public static void testRequestWithdraw() {
Gamebase.TemporaryWithdrawal.requestWithdrawal(new GamebaseCallback() {
@Override
public void onCallback(TemporaryWithdrawalInfo data GamebaseException exception) {
if (!Gamebase.isSuccess(exception)) {
if (exception.getCode() == GamebaseError.AUTH_WITHDRAW_ALREADY_TEMPORARY_WITHDRAW) {
// Already requested temporary withdrawal before.
} else {
// Request temporary withdrawal failed.
return;
}
}
// Request temporary withdrawal success.
}
});
}
// Login after requested withdrawal
public static void testLogin() {
Gamebase.login(activity, provider, new GamebaseDataCallback<AuthToken>() {
@Override
public void onCallback(AuthToken data, GamebaseException exception) {
if (!Gamebase.isSuccess(exception)) {
// Login failed
return;
}
// Check if user is requesting withdrawal
if (data.getTemporaryWithdrawalInfo() != null) {
// User is under temporary withdrawal
long gracePeriodDate = data.getTemporaryWithdrawalInfo().getGracePeriodDate();
} else {
// Login success.
}
}
});
}
See also
com.toast.android.gamebase.auth.data.TemporaryWithdrawalInfo.
com.toast.android.gamebase.GamebaseDataCallback.
com.toast.android.gamebase.Gamebase#login(Activity, String, GamebaseDataCallback)
com.toast.android.gamebase.auth.data.AuthToken.

◆ withdrawImmediately()

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

This function ignores the withdrawal grace period and proceeds withdrawal immediately.


Internally, this function works exactly the same as the com.toast.android.gamebase.Gamebase#withdraw(Activity, GamebaseCallback).

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

Example Usage:

public static void testWithdrawImmediately() {
Gamebase.TemporaryWithdrawal.withdrawImmediately(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.
com.toast.android.gamebase.Gamebase#withdraw(Activity, GamebaseCallback).
Here is the call graph for this function: