Table of Contents | ||
---|---|---|
|
Prerequisites
Do Android Get Started all the way until finishing step 3
Step Summary
Add the Initialization code.
Add the wrapper/trigger (transitions or button clicks) into your app.
Follow our ad format guides for their implementation.
Test everything is working
Change everything to production code
Your app is now prepared for monetization with us.
We only mention how to create wrappers and not triggers because the way a trigger is fetch for its use is highly dependant on your specific app code.
Wrappers and Triggers/Events are used for different formats, each ad format page tells you what you need to use (wrapper or trigger) to display it.
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 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. |
...
Code Block | ||||
---|---|---|---|---|
| ||||
class Application: Application() { override fun onCreate() { super.onCreate() R89SDK.setDebug() //This is for testing purposes, remove it on prod R89SDK.setLogLevel(LogLevels.DEBUG) //This is for testing purposes, remove it on prod R89SDK.initialize( appContext = this, publisherId = "TestRefinery89ID", /* This is for testing purposes, change it on prod */ appId = "TestDemoApp", /* This is for testing purposes, change it on prod */ singleLine = false, initializationEvents = null ) } } |
Info |
---|
You will receive your Your |
...
Then add this application class to the manifest you already had from the Android Get Started.
The code for adding the application is the following
...
Code Block |
---|
<manifest> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="com.google.android.gms.permission.AD_ID"/> <application android:name=".Application"> <!-- This is the Sample App ID--> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713"/> </application> </manifest> |
Add wrappers to your Views
Wrappers are the container inside which the ads will show. You need to add as many as ad slots or ad places you desire.
...
Code Block |
---|
//Remember to use this Code only once since findViewById is an expensive method val myWrapper = findViewById<ViewGroup>(R.id.myWrapper) |
Follow our Ad Formats guides
Child pages (Children Display) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Go into production
Remove the methods
R89SDK.setDebug()
Change the Google app id in the manifest for the production one
Change the
appId
andpublisherId
in the initialization method for the production onesChange the
r89ConfigId
in the formats for the production onesit’s also recommended to remove
R89SDK.setLogLevel(LogLevels.DEBUG)
but not needed
How does it works?
We fetch all ad units configurations from our Database and you simply need to place the ad units using the RefineryAdFactory
and the r89ConfigurationIDs
we provide you. Incorporate them into the desired views.
...