The Nexverse SDK enables you to monetize your Android application with various types of high-quality ads. This guide provides step-by-step instructions for integrating the SDK and implementing different Ad formats.

Pre-requisites

Before integrating the SDK, ensure the following requirements are met:

  • Minimum Kotlin Version: 1.9.0
  • Minimum Kotlin Standard Library Version: 1.9.0
  • Minimum Android Version Support: API level 16 and above
  • JDK Version: Java 8
  • accountId and configId from Nexverse publisher dashboard

Installation

Include Maven Central in your top-level build.gradle file -

  allprojects {
    repositories {
        mavenCentral()
    }
}
  

Add Dependencies

Core SDK Dependency

  • Add the following dependency in your module’s build.gradle file, dependencies section:
  implementation("ai.nexverse:ai-nexverse-sdk-core:x.x.x") // Replace x.x.x with the latest version
  

Optional Dependencies

Depending on the Ad formats you want to support, you may need to add additional dependencies.

Video Banner Ads:

If you want to support video Ads on Media3 or Exo player, you will need to add one of the following dependencies:

Media3 Dependency:

  implementation("ai.nexverse:ai-nexverse-sdk-media3-extn:x.x.x") // Replace x.x.x with the latest version
  

ExoPlayer Dependency:

  implementation("ai.nexverse:ai-nexverse-sdk-exo-extn:x.x.x") // Replace x.x.x with the latest version
  

Add Permissions

Add the required permissions in your AndroidManifest.xml file:

  <!-- Required permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  

Location Permission API

To improve Ad targeting and provide a better Ad experience, you can include location permission in your app:

  <!-- Optional permissions for location-based targeting -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  

Storage Permission

To improve rich media Ad experience, you can include storage permission in your app:

  <!-- Optional permission for MRAID 2.0 storePicture Ads -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  

Initialization

Prerequisites

The SDK must be initialized before requesting any ads. This one-time initialization sets up the SDK with your account configuration and prepares it for Ad delivery. SDK can be initialized from activity or fragment or application, we recommend to initialize the sdk from Application class’s onCreate() method.

Create the initialization configuration:

Initialize the SDK:

SDK Initialization Parameters

Parameter Usage
appContext Application/activity/fragment context to initialize SDK
accountId Account Id shared by the Nextverse team.
videoPlayerProviderClass VideoPlayerViewImpl::class.java if using exo or media3 extension, otherwise leave empty.

Get SDK Initialize status :

Description: This method is used to check whether the SDK has been successfully initialized in the application. It helps developers verify that the SDK is ready before making Ad requests, ensuring smooth ad/request handling and preventing unexpected errors.

Return Value:

  • true → SDK is initialized and ready to use.
  • false → SDK is not initialized, possibly due to missing configuration, network issues, or incorrect account Id.

Additional information for better reach

setGlobalOrtbConfig

Sets the global OpenRTB (oRTB) configuration parameters used for Ad requests. Parameters:

  • targetingParams: JSON string containing key-value pairs for targeting (e.g., user segments, interests, demographics).

Recommended Usage: Call this once during initialization to set global parameters. Can also be updated later if targeting information changes (e.g., after user login).


setGDPRConsentString

Configures the SDK with the user’s GDPR consent string. This is typically obtained from a CMP (Consent Management Platform). Parameters: gdprConsentString: The IAB-compliant GDPR consent string representing the user’s preferences.

Recommended Usage: Call this method before requesting Ads to ensure consent is respected. Update whenever a new consent string is obtained from the CMP.


setSubjectToGDPR

Specifies whether the user is subject to GDPR regulations. Parameters: gdprConsent: Pass true if GDPR applies to the user, otherwise false.

Recommended Usage: Should be called at initialization, based on user’s region or CMP determination. Must be set before passing GDPR consent string.


setSubjectToCOPPA

Specifies whether the user is subject to COPPA (Children’s Online Privacy Protection Act) compliance. Parameters: coppaConsent: Pass true if COPPA applies to the user, otherwise false.

Recommended Usage: Call during SDK initialization if your app is directed towards children under 13 or needs COPPA compliance. Once set, should not be changed during the session.

Account ID & Config Id

To start using the SDK, you need an Account ID, get your Account ID inside Nexverse dashboard:


configId: A unique identifier based on the Ad format and placement in your app. Obtain this from your Nexverse publisher dashboard:

Load & Render Ads

Nexverse SDK offers a comprehensive suite of Ad formats to help you maximize your app’s revenue potential. Each format is designed to provide a seamless user experience while delivering effective advertising content.

Prerequisites

Banner Ads are rectangular display units that occupy a portion of your app’s layout. The SDK supports both HTML and Video banner formats. These Ads can be placed at various positions within your app’s interface and can be configured to refresh automatically at specified intervals.

HTML Banner Ads

HTML banners are the most common type of banner ads. They can display static images, animated content, or interactive rich media.

Add a FrameLayout in your layout file to host the banner:

  <FrameLayout
    android:id="@+id/frameAdWrapper"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/white"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"/>
  

Create and configure the banner in your Activity:

Video Banner Ads

Video banner Ads provide an engaging way to monetize your app through video content. These Ads play video content directly within a banner format.

Use the same FrameLayout as HTML banners:

  <FrameLayout
    android:id="@+id/frameAdWrapper"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/white"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"/>
  

Create and configure the video banner:

XML Layout

Add the following BannerView in your layout file (e.g., activity_main.xml): for xml based implementation

  <ai.nexverse.sdk.core.api.rendering.BannerView
    android:id="@+id/banner_ad_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="84dp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:configId="nexverse-banner-300-250-config-id"
    app:adWidth="300"
    app:adHeight="250"
    app:refreshIntervalSec="80" />
  

Interstitial Ads

Interstitial Ads are full-screen Ads that cover the interface of their host app. They’re typically displayed at natural transition points in your app’s flow, such as between levels in a game, between activities, or after completing a task. The SDK supports both display (static) and video interstitial formats, as well as a multi-format option that can handle both types.

Best practices:

  • Show Ads at natural break points in your app
  • Avoid interrupting users during critical tasks
  • Implement proper loading and error handling
  • Consider user experience when choosing frequency

Display Interstitial

Display interstitials show full-screen static Ads that can include images and interactive elements. They typically load faster than video interstitials and are great for areas with slower internet connections.

Video Interstitial

Video interstitials deliver full-screen video Ad experiences. They typically have higher engagement rates and eCPMs compared to display interstitials, but may require more bandwidth and loading time.

Multi-format Interstitial

Recommended: MultiFormat interstitials provide the most flexibility by supporting both display and video Ads in a single implementation. This format automatically selects the best available Ad type based on:

  • Ad availability
  • Network conditions
  • Historical performance
  • User preferences

To implement a MultiFormat interstitial that can serve both video and display ads:

This configuration maximizes fill rate by being able to serve either Ad type, while the SDK handles all the complexity of format selection and delivery. The Ad type selection is optimized automatically to provide the best balance of user experience and revenue.


Native Ads

Native Ads offer the most flexible and customizable Ad experience. They allow you to match the look and feel of your app by customizing every visual element of the Ad. This seamless integration can lead to better user experience and higher engagement rates. Native Ads are particularly effective in content feeds, article lists, or any situation where you want the Ad to feel like a natural part of your app.

Implementation steps:

Add a container in your layout:

  <FrameLayout
    android:id="@+id/frameAdWrapper"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/white"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"/>
  

Create and configure the native ad:


Rewarded Ads

Rewarded Ads are a powerful monetization tool that provides value to both users and developers. They allow users to earn in-app rewards (such as virtual currency, extra lives, or premium content) in exchange for watching a video Ad. This opt-in format typically sees high engagement rates and user satisfaction.

Key benefits:

  • Higher user engagement due to opt-in nature
  • Better user experience through value exchange
  • Increased retention through reward mechanics
  • Higher eCPMs compared to other Ad formats

Implementation:

Create and configure the rewarded Ad unit:

Advance Configuration And Controls

Location And Permission Configuration

The SDK provides two methods to manage user consent for location sharing and handle runtime location permission requests.

fun shareGeoLocation(shouldShare: Boolean):

Sets the user’s consent for sharing location information if the app want to trigger requesting location permission as per there usecase.

Parameters:

shouldShare – true if the publisher consents to share location details with the SDK, false otherwise.

Behavior:

  • If location permission (ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION) is already granted:
    • The SDK will use the device’s location information when making requests (if shouldShare = true).
    • If shouldShare = false, the SDK will stop using location data.
  • If location permission is not granted, this method does not request it. Use triggerLocationPermission instead.

fun triggerLocationPermission(shouldShare: Boolean, context: Context, listener: LocationPermissionListener? = null):

Requests user consent for location sharing and handles runtime permission request if required by publisher. This is recommended when the application does not already implement its own location permission request flow.

Parameters:

  • shouldShare – true if the user consents to share location information, false otherwise.
  • context – Context used to display the runtime permission dialog.
  • listener – Optional LocationPermissionListener callback to receive the permission request result.

Behavior:

  • If location permission is already granted:
    • SDK applies the consent setting (shouldShare) immediately.
    • Callback is invoked with PermissionResult.GRANTED.
  • If location permission is not granted:
    • SDK triggers the system runtime permission dialog.
    • Callback receives one of:
      • GRANTED → User allowed location access.
      • DENIED → User denied location access (but may be asked again later).
      • ALREADY_DENIED → User previously denied with “Don’t ask again”.
  • If shouldShare = false, the SDK disables location sharing regardless of permission state.

Video Ads

Video & Volume Control Customization

By default, Ads rendered by the SDK may include video playback controls (play/pause) and volume controls (mute/unmute). Developers can choose to hide these controls for a customized Ad experience.

The following methods are available depending on the Ad format:

Banner Ads

bannerView.hideVideoControl()

Hides the video playback controls (play/pause) from a banner ad’s video element.

  • When to use:
    • If you want a simplified UI where the banner video runs without user controls.
    • For autoplay video banners where user interaction is not required.

Example:

Interstitial & Reward Ads

For interstitial and rewarded Ad units, you can control visibility of playback and volume controls using the InterstitialAdUnit or RewardedAdUnit object.

Hides the video playback controls in interstitial or rewarded ads. Example:

Video Playback & Audio Control

In addition to hiding video/volume controls, the SDK provides programmatic methods to control video playback and audio state for banner ads.

These methods can be used to manually control playback and sound without relying on user interaction with UI controls.

bannerView?.play()

  • Starts or resumes video playback in a banner Ad. Can be used to autoplay Ads programmatically.

bannerView?.pause()

  • Pauses video playback in a banner Ad. can be used to pause the video programatically.

bannerView?.resume()

  • Resume video play in a banner Ad. can be used to resume the video programatically.

bannerView?.mute()

  • Mutes the video audio in a banner Ad. Can be used ensure Ads always play silently.

bannerView?.unMute()

  • Unmutes the video audio in a banner Ad. Can be used to allow sound playback.

Ad Click to landing page behaviour

By default, Ad click will opent the landing page in the Chrome Tab. Publishers can choose other options by setting RedirectionType to the bannerView or AdUnit as below -

bannerView?.setRedirectionType(RedirectionType redirectionType)

interstitialAdUnit?.setRedirectionType(RedirectionType redirectionType)

rewardAdUnit?.setRedirectionType(RedirectionType redirectionType)

nativeAdUnit?.setRedirectionType(RedirectionType redirectionType)

There are 3 types of redirection supported by SDK

  1. CUSTOM_TAB: Opens the landing page within the Chrome Tab.
  2. EXTERNAL_BROWSER: Opens the landing page in the internal browser managed by the SDK.
  3. INTERNAL_BROWSER: Opens the landing page in the external browser chosen by the user.