Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagekotlin
#MainActivity.kt->onCreate()
val interstitialConfigId = ConfigBuilder.INTERSTITIAL_TEST_R89_CONFIG_ID
val activityToShowOver = this

var interstitialId = RefineryAdFactory.createInterstitial(
interstitialConfigId, 
activityToShowOver, 
afterInterstitial = {
    // Here you could load the next activity or fragment. Basically recover app flow
    Log.d("Interstitial", "After Interstitial")
    //Example
    val newActivityIntent = Intent(this, NewActivity::class.java)
    startActivity(newActivityIntent)
})
Info

You will receive your interstitialConfigId will be provided to you during onboarding process by email, you can also retrieve them from the web interface after login.

They can be many or none depending on your requests, if you need one or more please request them to your account manager or technical account manager.

Show On Button Press

Some event takes place in you app, such as a button press, tab change or opening a link, screen transition.

...

Code Block
languagekotlin
#MainActivity.kt

private fun createInterstitial()
{
	val interstitialAdIdinterstitialConfigId = ConfigBuilder.INTERSTITIAL_TEST_R89_CONFIG_ID
	val lifecycleEvents = object : InterstitialEventListener
	{
		/* 
		 * We need to call show on the onLoaded event and on the OnFailedToLoad event,
		 * this is to show the ad in both cases so the afterInterstitial event is called
		 */
		override fun onLoaded()
		{
			RefineryAdFactory.show(interstitialId)
		}

		override fun onFailedToLoad(error: R89LoadError)
		{
			RefineryAdFactory.show(interstitialId)
		}
		....
	}

	interstitialId = RefineryAdFactory.createInterstitial(
		interstitialAdIdinterstitialConfigId , 
		this,
		afterInterstitial = {
			Log.d("Interstitial", "After Interstitial")
		},
		lifecycleCallbacks = lifecycleEvents
	)

}
Info

You will receive your interstitialConfigId will be provided to you during onboarding process by email, you can also retrieve them from the web interface after login.

They can be many or none depending on your requests, if you need one or more please request them to your account manager or technical account manager.

Lifecycle Events

You can subscribe to these events with the same method but passing a new object as a parameter. Details about this object can be found in the Reference.

...