This project contains a minimal example application to start displaying Ads with Aniview's Ada library.
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.
Here are steps to configure a fresh project:
- Add Maven repository in the
settings.gradle.kts
file:
dependencyResolutionManagement {
repositories {
maven("https://us-central1-maven.pkg.dev/mobile-sdk-fd2e4/adservr-maven")
}
}
- Add Maven dependencies in the app's
build.gradle.kts
file:
dependencies {
implementation("com.adservrs:ada:1.1.1")
}
- Add
AdaView
in the code:
val config = AdaConfig(
pubId = "published id",
tagId = "tag id",
)
parent.addView(AdaView(context, config))
- 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>
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) {}
})