Gamebase SDK for Android  1.5.0
Toast Gamebase Platform
Gamebase.Util Class Reference

This class provides Android utility functions. More...

Collaboration diagram for Gamebase.Util:
Collaboration graph

Static Public Member Functions

static void showToast (@NonNull final Context context, @NonNull final String message, @ToastDuration int duration)
 Show a standard toast that just contains a text view. More...
 
static void showAlert (@NonNull final Context context, @NonNull final String title, @NonNull final String message)
 This method to create the dialog and display it on screen. More...
 
static void showAlert (@NonNull final Context context, @NonNull final String title, @NonNull final String message, @Nullable final DialogInterface.OnClickListener clickListener)
 This method to create the dialog and display it on screen. More...
 
static void requestPermissions (@NonNull Context context, @NonNull List< String > permissions, @Nullable PermissionsUtil.RequestPermissionCallback callback)
 Request android permissions in runtime. More...
 
static boolean checkPermissions (@NonNull Context context, @NonNull List< String > permissions)
 Determine whether you have been granted a particular permission. More...
 

Detailed Description

This class provides Android utility functions.

Member Function Documentation

◆ checkPermissions()

static boolean checkPermissions ( @NonNull Context  context,
@NonNull List< String >  permissions 
)
static

Determine whether you have been granted a particular permission.

Since
Added 1.4.0.
Parameters
contextMain activity.
permissionsThe name of the permission being checked.
Returns
Over OS 6.0(API 23, M), true if all of the permission are granted, false otherwise Under OS 6.0, true will be returned always.

◆ requestPermissions()

static void requestPermissions ( @NonNull Context  context,
@NonNull List< String >  permissions,
@Nullable PermissionsUtil.RequestPermissionCallback  callback 
)
static

Request android permissions in runtime.

Since
Added 1.4.0.
Parameters
contextA Context of the application package implementing this class.
permissionsThe name of the permissions that are needed.
callbackThe callback.

◆ showAlert() [1/2]

static void showAlert ( @NonNull final Context  context,
@NonNull final String  title,
@NonNull final String  message 
)
static

This method to create the dialog and display it on screen.

Since
Added 1.4.0.
Parameters
contextThe context to use. Usually your android.app.Application or android.app.Activity object.
titleThe title displayed in the dialog.
messageThe message to display.

◆ showAlert() [2/2]

static void showAlert ( @NonNull final Context  context,
@NonNull final String  title,
@NonNull final String  message,
@Nullable final DialogInterface.OnClickListener  clickListener 
)
static

This method to create the dialog and display it on screen.

Since
Added 1.4.0.
Parameters
contextThe context to use. Usually your android.app.Application or android.app.Activity object.
titleThe title displayed in the dialog.
messageThe message to display.
clickListenerThe clickListener to be invoked when the button of the dialog is pressed.

◆ showToast()

static void showToast ( @NonNull final Context  context,
@NonNull final String  message,
@ToastDuration int  duration 
)
static

Show a standard toast that just contains a text view.

Since
Added 1.4.0.
Parameters
contextThe context to use. Usually your android.app.Application or android.app.Activity object.
messageThe message to show.
durationHow long to display the message. Either android.widget.Toast#LENGTH_SHORT or android.widget.Toast#LENGTH_LONG