Gamebase SDK for Android 2.50.0
NHN Cloud Gamebase Platform
Loading...
Searching...
No Matches
Gamebase.Terms Class Reference

This class provides functionality related to terms of use view. More...

Collaboration diagram for Gamebase.Terms:
Collaboration graph

Static Public Member Functions

static void showTermsView (@NonNull Activity activity, @Nullable GamebaseDataCallback< GamebaseDataContainer > callback)
 Show terms and conditions web view. More...
 
static void showTermsView (@NonNull Activity activity, @Nullable GamebaseTermsConfiguration configuration, @Nullable GamebaseDataCallback< GamebaseDataContainer > callback)
 Show terms and conditions web view. More...
 
static void queryTerms (@NonNull Activity activity, @NonNull GamebaseDataCallback< GamebaseQueryTermsResult > callback)
 Request terms and conditions items list from Gamebase console. More...
 
static void updateTerms (@NonNull Activity activity, @NonNull GamebaseUpdateTermsConfiguration configuration, @Nullable GamebaseCallback callback)
 Send the agreement to the terms and conditions to the Gamebase server. More...
 
static boolean isShowingTermsView ()
 This is the method to check if terms view is being shown. More...
 

Detailed Description

This class provides functionality related to terms of use view.

Member Function Documentation

◆ isShowingTermsView()

static boolean isShowingTermsView ( )
static

This is the method to check if terms view is being shown.

Since
Added 2.35.0

◆ queryTerms()

static void queryTerms ( @NonNull Activity  activity,
@NonNull GamebaseDataCallback< GamebaseQueryTermsResult >  callback 
)
static

Request terms and conditions items list from Gamebase console.

This API can be used when you create custom terms and conditions agreement UI. If you call after logging in, you can also check whether the user agrees to the terms and conditions, except whether to receive notification.

Since
Added 2.20.0
Parameters
activityCurrent activity.
callbackInformation on terms and conditions registered in the console. After logging in, whether you agree to the terms and conditions is returned, except whether to receive notification.

Example Usage:

@Override
public void onCallback(GamebaseQueryTermsResult result, GamebaseException exception) {
if (Gamebase.isSuccess(exception)) {
// Succeeded.
final int termsSeq = result.getTermsSeq();
final String termsVersion = result.getTermsVersion();
final String termsCountryType = result.getTermsCountryType();
final List<GamebaseTermsContentDetail> contents = result.getContents();
// Another country device.
// Pass the 'terms and conditions' step.
} else {
// Failed.
}
}
});
This class provides functionality related to terms of use view.
Definition: Gamebase.java:2980
static void queryTerms(@NonNull Activity activity, @NonNull GamebaseDataCallback< GamebaseQueryTermsResult > callback)
Request terms and conditions items list from Gamebase console.
Definition: Gamebase.java:3117
This class is a wrapper class that is provided to use various features of Gamebase platform.
Definition: Gamebase.java:61
static boolean isSuccess(@Nullable final GamebaseException exception)
Returns true if the GamebaseException object is null or the error code is zero.
Definition: Gamebase.java:160
Class responsible for creating error codes and error objects.
Definition: GamebaseError.java:23
static final int UI_TERMS_NOT_EXIST_FOR_DEVICE_COUNTRY
Definition: GamebaseError.java:181
An object that contains the success or failure of the execution of the Gamebase function.
Definition: GamebaseException.java:26
int getCode()
Get result code.
Definition: GamebaseException.java:157
Generic callback interface that returns data.
Definition: GamebaseDataCallback.java:12
See also
com.toast.android.gamebase.GamebaseDataCallback.
com.toast.android.gamebase.terms.data.GamebaseQueryTermsResult
com.toast.android.gamebase.terms.data.GamebaseTermsContentDetail

◆ showTermsView() [1/2]

static void showTermsView ( @NonNull Activity  activity,
@Nullable GamebaseDataCallback< GamebaseDataContainer >  callback 
)
static

Show terms and conditions web view.

Since
Added 2.20.0
Parameters
activityCurrent activity.
callbackcalled when the browser closed.

Example Usage:

static PushConfiguration savedPushConfiguration = null;
Gamebase.Terms.showTermsView(activity, (container, exception) -> {
if (Gamebase.isSuccess(exception)) {
// Save the PushConfiguration and use it for Gamebase.Push.registerPush()
// after Gamebase.login().
GamebaseShowTermsViewResult termsViewResult = GamebaseShowTermsViewResult.from(container);
if (termsViewResult != null) {
savedPushConfiguration = termsViewResult.pushConfiguration;
}
} else {
new Thread(() -> {
// Wait for a while and try again.
try { Thread.sleep(2000); }
catch (Exception ignored) {}
showTermsView(activity, callback);
}).start();
}
});
public void afterLogin(Activity activity) {
// Call registerPush with saved PushConfiguration.
if (savedPushConfiguration != null) {
Gamebase.Push.registerPush(activity, savedPushConfiguration, exception -> {...});
}
}
static void showTermsView(@NonNull Activity activity, @Nullable GamebaseDataCallback< GamebaseDataContainer > callback)
Show terms and conditions web view.
Definition: Gamebase.java:3023
Parameter class for the initialization of the GamebaseToastPushable#registerToken(Activity,...
Definition: PushConfiguration.java:27
See also
com.toast.android.gamebase.GamebaseDataCallback.
com.toast.android.gamebase.base.data.GamebaseDataContainer
com.toast.android.gamebase.terms.data.GamebaseShowTermsViewResult.
com.toast.android.gamebase.base.push.PushConfiguration
com.toast.android.gamebase.Gamebase.Push#registerPush(Activity, PushConfiguration, GamebaseCallback)

◆ showTermsView() [2/2]

static void showTermsView ( @NonNull Activity  activity,
@Nullable GamebaseTermsConfiguration  configuration,
@Nullable GamebaseDataCallback< GamebaseDataContainer >  callback 
)
static

Show terms and conditions web view.

Since
Added 2.33.0
Parameters
activityCurrent activity.
configurationThe initial settings of terms view.
callbackcalled when the browser closed.

Example Usage:

static PushConfiguration savedPushConfiguration = null;
.setForceShow(true)
.build();
Gamebase.Terms.showTermsView(activity, configuration, (container, exception) -> {
if (Gamebase.isSuccess(exception)) {
// Save the PushConfiguration and use it for Gamebase.Push.registerPush()
// after Gamebase.login().
GamebaseShowTermsViewResult termsViewResult = GamebaseShowTermsViewResult.from(container);
if (termsViewResult != null) {
savedPushConfiguration = termsViewResult.pushConfiguration;
}
} else {
new Thread(() -> {
// Wait for a while and try again.
try { Thread.sleep(2000); }
catch (Exception ignored) {}
showTermsView(activity, callback);
}).start();
}
});
public void afterLogin(Activity activity) {
// Call registerPush with saved PushConfiguration.
if (savedPushConfiguration != null) {
Gamebase.Push.registerPush(activity, savedPushConfiguration, exception -> {...});
}
}
GamebaseTermsConfiguration build()
This method creates an instance of com.toast.android.gamebase.terms.GamebaseTermsConfiguration.
Definition: GamebaseTermsConfiguration.java:69
Builder setForceShow(boolean forceShow)
Regardless of whether you agree to the terms and conditions, always display the terms ui.
Definition: GamebaseTermsConfiguration.java:82
Parameter class for the initialization of com.toast.android.gamebase.Gamebase.Terms#showTermsView(Act...
Definition: GamebaseTermsConfiguration.java:19
static Builder newBuilder()
The factory method to create an instance of the builder to build com.toast.android....
Definition: GamebaseTermsConfiguration.java:42
See also
com.toast.android.gamebase.terms.GamebaseTermsConfiguration.
com.toast.android.gamebase.GamebaseDataCallback.
com.toast.android.gamebase.base.data.GamebaseDataContainer
com.toast.android.gamebase.terms.data.GamebaseShowTermsViewResult.
com.toast.android.gamebase.base.push.PushConfiguration
com.toast.android.gamebase.Gamebase.Push#registerPush(Activity, PushConfiguration, GamebaseCallback)

◆ updateTerms()

static void updateTerms ( @NonNull Activity  activity,
@NonNull GamebaseUpdateTermsConfiguration  configuration,
@Nullable GamebaseCallback  callback 
)
static

Send the agreement to the terms and conditions to the Gamebase server.

This can also be used to change the content of the optional terms and conditions.

Since
Added 2.20.0
Parameters
activityCurrent activity.
configuration
callback

Example Usage:

@Override
public void onCallback(GamebaseQueryTermsResult result, GamebaseException queryTermsException) {
if (Gamebase.isSuccess(queryTermsException)) {
// Succeeded to query terms.
final int termsSeq = result.getTermsSeq();
final String termsVersion = result.getTermsVersion();
final List<GamebaseTermsContent> contents = new ArrayList<>();
for (GamebaseTermsContentDetail detail : result.getContents()) {
GamebaseTermsContent content = GamebaseTermsContent.from(detail);
// Change agree value what you want!
content.setAgreed(agreeOrNot);
contents.add(content);
}
final GamebaseUpdateTermsConfiguration configuration =
GamebaseUpdateTermsConfiguration.newBuilder(termsSeq, termsVersion, contents)
.build();
Gamebase.Terms.updateTerms(activity, configuration, new GamebaseCallback() {
@Override
public void onCallback(GamebaseException updateTermsException) {
if (Gamebase.isSuccess(updateTermsException)) {
// Succeeded to update terms.
} else {
// Failed to update terms.
}
}
});
} else {
// Failed to query terms.
}
}
});
static void updateTerms(@NonNull Activity activity, @NonNull GamebaseUpdateTermsConfiguration configuration, @Nullable GamebaseCallback callback)
Send the agreement to the terms and conditions to the Gamebase server.
Definition: Gamebase.java:3172
Definition: GamebaseCallback.java:9
See also
com.toast.android.gamebase.terms.data.GamebaseUpdateTermsConfiguration
com.toast.android.gamebase.terms.data.GamebaseTermsContent
com.toast.android.gamebase.GamebaseCallback.