Integrating Utility Module

This section explains the steps to integrate the now.gg Utility module with your development environment.

To get started, download the now.gg SDK download package that contains the now.gg Utility module and add it to your development environment.

Add SDK Libraries

Start by downloading the now.gg SDK package that contains the Utility module libraries and add them to your development environment by following the steps below:

Note: The now.gg SDK package contains the Utility module and sample code.

1. Extract the compressed now.gg Utility module and locate the .aar file in the package:

 Utility.aar

2. Add the following dependency to the build.gradle file of your game:

dependencies {
         implementation fileTree(dir: 'libs', include: ['*.aar'])
 }


Implement Utility Module

Once the module has been successfully imported, you can now use the now.gg Utility Module.

The Utility module includes the following methods:

  • Device Type
    Using this method, you to detect the user’s device, e.g., phone, tablet, desktop, etc.
  • Open URL
    Using this method, you can open a URL in a new browser window on the user’s device.
  • Platform Detection
    Using this method, you can ensure that your app is running on now.gg platform.

References

1. Device Type

The getDeviceType() method lets you detect the user’s device type.

The device types include:

  • SMARTPHONE
  • TABLET
  • DESKTOP
  • UNKNOWN (Shown if the user’s device type cannot be detected)

To get the device type, call the getDeviceType() method, as illustrated below:

    DeviceType deviceType = UtilitySDK.getInstance().getDeviceType(applicationContext);

Reference – You can refer to the getDeviceType reference here.


2. Open Url

The openUrl() method lets you open a URL in a new browser window of the user’s device. The following sample code illustrates this implementation.

    UtilitySDK.getInstance().openUrl("<your_url_here>", applicationContext);

Reference – You can refer to the openUrl() reference here.


3. Platform Detection

The isRunningOnNowGG() method enables you to identify if your application is running on the now.gg platform or not. The following sample code illustrates this implementation:

    UtilitySDK.getInstance().isRunningOnNowGG(applicationContext)
Note: Returns true, If the application is running on now.gg.

Reference – You can refer to the isRunningOnNowGG() reference here.


×

Table of Contents

Integrating Utility Module

Table of Contents

Document Rev. 1.0

Text copied to clipboard
Link copied to clipbord
Questions? Please reach out to us at dev-support@now.gg