showTermsView

open fun showTermsView(@NonNull activity: Activity, @Nullable callback: GamebaseDataCallback<GamebaseDataContainer>)

Show terms and conditions web view.

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 -> {...});
    }
}

Since

Added 2.20.0

Parameters

activity

Current activity.

callback

called when the browser closed.

See also


open fun showTermsView(@NonNull activity: Activity, @Nullable configuration: GamebaseTermsConfiguration, @Nullable callback: GamebaseDataCallback<GamebaseDataContainer>)

Show terms and conditions web view.

Example Usage:

static PushConfiguration savedPushConfiguration = null;
final GamebaseTermsConfiguration configuration = GamebaseTermsConfiguration.newBuilder()
        .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 -> {...});
    }
}

Since

Added 2.33.0

Parameters

activity

Current activity.

configuration

The initial settings of terms view.

callback

called when the browser closed.

See also