The VIS.X® SDK interstitial integration will provide you access to regular interstitials and our YOC Mystery Ad®, a high-impact full-screen overlay powered by YOC.
Calling and Rendering an Interstitial Ad
To request an interstitial ad, you need to create an instance of the VisxAdManager
in your Activity
with its related builder and .build()
. Also, you need to set up VisxCallbacks
and specifically the mandatory callback onAdLoadingFinished
.
Once an ad is received, onAdLoadingFinished
will allow executing VisxAdManager.
showModalInterstitial()` to display the interstitial.
class MyActivity : AppCompatActivity() {
private lateinit var visxAdManager: VisxAdManager
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_article)
var visxCallbacks = VisxCallbacks {
override fun onAdLoadingFinished(visxAdManager: VisxAdManager?, message: String?) {
visxAdManager?.showModalInterstitial()
}
override fun onAdLoadingFailed(message: String?, errorCode: Int, isFinal: Boolean) {
Log.i("onAdLoadingFailed() $message errorCode: $errorCode")
}
}
visxAdManager = VisxAdManager.Builder()
.context(this)
.callback(visxCallbacks)
.visxAdUnitID("123456")
.adSize(Size(320, 480))
.interstitial()
.build()
}
}
Builder Methods | Description |
---|---|
.context(Context) | The Activity’s Context, normally it would be this . Please do not use the application context provided by Activity.getApplicationContext() . |
.visxAdUnitId(String) | VIS.X® Ad Unit ID, provided by YOC |
.adSize(Size) | The default Size of your interstitial ads |
.callback(VisxCallbacks) | Reference to the VisxCallbacks used for all types of callbacks, as listed here. |
Per default, there is a threshold of 30 minutes between build()
and showModalInterstitial()
in which the impression needs to be delivered, otherwise, the impression will expire. If required, the expiration timeout can be adjusted by YOC in exceptional cases.
Adding Background Color
The default background color of interstitials is transparent with a slight opaque for visual separation from the content. You can overwrite the color using the method .setInterstitialBackground(int color)
from the Builder pattern. Color can be either Color Resources or Color Constants.
Your interstitial is fully set up and ready for testing.
We advise you to share a build of your app with the YOC Service Team, to validate and fully test the integration together. Reach out to your contact at YOC to request test resources.