Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
stylenone

Prerequisites

Step Summary

  1. Add the Initialization code.

  2. Add the Application class to the Manifest (in case you are using it)

  3. Add the Tagged Wrappers, Tagged Buttons and Note the Transitions

  4. Add the testing Single Data

  5. Test everything is working

  6. Change everything to production code

  7. Your app is now prepared for monetization with us.

Initialize the SDK

Note

We require the SDK to be initialized only once as early as possible so for this purpose using Android’s application class is recommended but if your app only has one activity, if using the activity make sure it is never destroyed unless killing the app or placing it in the background, matching then the lifecycle of Application, you can initialize it in onCreate method of that Activity.

...

We will come back to this Application class to add our testing single tag data, but let's first add the tagged wrappers and events

Tagged wrappers

Tagged Wrappers are the container inside which the ads will show, they are normal wrappers with the android:tag attribute set. You need to add as many as you can, remember that placing a tagged wrapper does not mean we need to use it.

...

Info

With this added to your views we can detect that tag and place an ad inside of it if the single tag data says so.

Events

Events can trigger other formats, right now the single tag supports:

  • Transitions events are detected by the single tag automatically after initialization. They happen when an activity or fragment is started from other activity or fragment.

  • Button Presses when a button is pressed, this works They are detected by adding the android:tag attribute to the button.

Ex of transition:

Code Block
class MainActivity : AppCompatActivity()
{
	override fun onCreate(savedInstanceState: Bundle?)
	{
		super.onCreate(savedInstanceState)
		setContentView(R.layout.activity_main_auto)
		
		findViewById<Button>(R.id.goToNewsPost).setOnClickListener {
			val intent = Intent(this, NewsPostDetailActivity::class.java).apply {
				putExtra("newsPostData", newPostData)
			}
			startActivity(intent)
		}
	}
}
Info

In this example an interstitial would be triggered when we see the NewsPostDetailActivity comes to live after loading.

...

Ex of button press:

with this button code

Code Block
# activity_main.xml
...
<Button
    android:id="@+id/play_video_trailer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:tag="play_video_trailer_tag" />
...

...

Info

In this example an interstitial would be triggered when the button is pressed and when the interstitial is closed the playVideoTrailer() method will be executed.

...

Adding testing single tag data

Go back to the application class that was created at the start of the guide, we are going to test all the transition, tagged wrappers and tagged buttons you have placed in the app.

...

Note

This step is for testing purposes and you are only going to see test ads when using this approach, but this is very helpful to us if you provide this peace of code to tell us where you want to place the ads.

Later when in production, this code have been removed and you have hopefully added flexible tagged wrappers and tagged all the button as possible so we can change your ad slots from the server without the need of updating the app.

Go into production

For going into production you will need to use you ids:

  • Remove the methods R89SDK.setDebug() and addTestingSingleTagData()

  • Change the Google app id in the manifest for the production one

  • Change the appId and publisherId in the initialization method for the production ones

  • it’s also recommended to remove R89SDK.setLogLevel(LogLevels.DEBUG) but not needed

...

How does it works?

We monitor your app to determine the active screen at any given moment. For each screen, we maintain a record of events and tags that you have supplied, enabling us to place ads in those tagged views or during specific transitions and events from the record.

...