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.

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

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

  • accountId: This unique identifier should be obtained from your Nexverse publisher dashboard.

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. It is recommended to perform this initialization in your Application class’s onCreate() method.

Create the initialization configuration:

Initialize the SDK:


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

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

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="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 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="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 video banner:


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

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: