Skip to content

Aniview/ada-android-example

Repository files navigation

Ada Example

This project contains a minimal example application to start displaying Ads with Aniview's Ada library.

How to run this example

Running this example requires publisher and tag ids. They can be configures in the root local.properties file like this:

sdk.dir=...

av_pub_id={published id goes here}
av_tag_id={tag id goes here}

After this project can simply be opened in the Android Studio and built.

How to configure fresh project

Here are steps to configure a fresh project:

  1. Add Maven repository in the settings.gradle.kts file:
dependencyResolutionManagement {
    repositories {
        maven("https://us-central1-maven.pkg.dev/mobile-sdk-fd2e4/adservr-maven")
    }
}
  1. Add Maven dependencies in the app's build.gradle.kts file:
dependencies {
    implementation("com.adservrs:ada:1.1.1")
}
  1. Add AdaView in the code:
val config = AdaConfig(
    pubId = "published id",
    tagId = "tag id",
)
parent.addView(AdaView(context, config))
  1. Add Google Mobile Ads application ID to AndroidManifest.xml:
<manifest>
    <application>
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-6746653557725812~6678258028"/>
    </application>
</manifest>

Observing Events

ADA library provides different events to track ads:

val view: AdaView
view.addListener(object : AdaViewListener {
    /**
     * New Ad was loaded
     */
    override fun onAdLoaded() {}

    /**
     * Failed to load an Ad
     */
    override fun onAdError() {}

    /**
     * Ad impression was triggered
     */
    override fun onAdImpression() {}

    /**
     * Next Ad can now be loaded
     */
    override fun onAdCanRefresh() {}

    /**
     * Ad was clicked
     */
    override fun onAdClicked(event: AdClickedEvent) {}
})

About

Sample application for Android Ada SDK

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages