Skip to main content

Getting Started

This guide will help you integrate the Nexad Android SDK into your application.

Prerequisites

Before you can start using the Nexad Android SDK, you'll need to get access by filling out our contact form. This will help us understand your use case and provide you with the necessary credentials.

Get started by filling out our form →

Once you've submitted the form, our team will review your request and provide you with:

  • Your unique App ID
  • Publisher ID
  • Any additional setup instructions specific to your integration

Installation

Add the following dependency to your app's build.gradle.kts:

dependencies {
implementation("com.nexad:sdk:1.0.0")
}

Or if using the older Groovy build.gradle:

dependencies {
implementation 'com.nexad:sdk:1.0.0'
}

Ensure you have the Maven Central repository in your project's settings.gradle:

repositories {
mavenCentral()
}

Local AAR (Alternative)

If you prefer to use the SDK directly as an AAR file:

  1. Download the latest AAR from the releases page
  2. Place the AAR file in your project's libs directory
  3. Add the following to your app's build.gradle:
dependencies {
implementation(files("libs/nexad-sdk-1.0.0.aar"))
}

Initialization

Initialize the SDK in your Application class:

class YourApplication : Application() {
override fun onCreate() {
super.onCreate()
NexadSDK.initialize(
context = applicationContext,
appId = "YOUR_APP_ID",
publisherId = YOUR_PUBLISHER_ID,
publisherName = "YOUR_PUBLISHER_NAME",
publisherType = PublisherType.CHATBOT // or PublisherType.SEARCH_ENGINE
)
}
}

Don't forget to register your Application class in your AndroidManifest.xml:

<application
android:name=".YourApplication"
...>
<!-- Your application components -->
</application>

Basic Ad Implementation

Native Ad Example

NexadSDK.getInstance().loadNativeAd("your_placement_id", object : AdDataLoadCallback {
override fun onSuccess(ads: List<Ad>) {
// Create and configure ad view
val adView = NexadSDK.getInstance().createNativeAdView(context, placement)
adView.configure(ads[0])

// Add to your container
containerView.addView(adView)
}

override fun onFailure(error: Exception) {
Log.e("NexadSDK", "Failed to load ad: ${error.message}")
}
})

WebView Ad Example

NexadSDK.getInstance().loadWebViewAd("webview", object : AdDataLoadCallback {
override fun onSuccess(ads: List<Ad>) {
if (ads.isNotEmpty()) {
// Create WebView for the ad
val webView = WebView(context)
webView.settings.javaScriptEnabled = true

// Load ad markup if available
val adMarkup = ads[0].adMarkup?.adm
if (!adMarkup.isNullOrEmpty()) {
webView.loadData(adMarkup, "text/html", "UTF-8")
}

// Add to your container
containerView.addView(webView)
}
}

override fun onFailure(error: Exception) {
Log.e("NexadSDK", "Failed to load ad", error)
}
})

Next Steps

Now that you have the SDK installed and initialized, you can learn more about: