Android Get Started
Prerequisites
Use Android Studio 3.2 or higher.
Create a project.
Make sure that your app’s build file uses the following values:
A
minSdkVersion
of21
or higher.A
compileSdkVersion
of33
or higher.
Step Summary
Configure you gradle build scripts
Add the app permissions to the manifest
Add the google app id to the manifest
Continue with Implementation type
1. Gradle Configuration
Gradle Buildscript
Project Level settings.gradle file :
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
App/Module level build gradle:
Get the latest version number from here
dependencies {
implementation ("com.refinery89.androidsdk:sharedCore-android:X.Y.Z")
}
Gradle Version catalogs
in app/module level build gralde:
dependencies {
implementation (libs.r89sdk)
}
and in libs.versions
[versions]
r89sdk = "X.Y.Z"
[libraries]
r89sdk = { module = "com.refinery89.androidsdk:sharedCore-android", version.ref = "r89sdk" }
2. Manifest Permissions
Add the following Permissions for SDK on the top of the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<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"/>
</manifest>
3. Manifest Google ID
Add the App ID to your app's AndroidManifest.xml
file. To do so, add a <meta-data>
tag with android:name="com.google.android.gms.ads.APPLICATION_ID"
, and for android:value
, insert the App ID, surrounded by quotation marks.
Add this code to the manifest inside the <application>
tag:
<manifest>
<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>
You will receive your app ID through your Technical Account manager by email, you can also retrieve them from the web interface after login.
Manifest End Result
This is a simplified example, you should have many more lines in the manifest, copy the important bits only.
<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>
<!-- 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>
Only read the following step if your technical account manager didn’t already provide an Implementation type to follow, otherwise continue there.
4. Choose Implementation type
Single Tag Implementation
This is what you are looking for? continue here → https://refinery89.atlassian.net/wiki/x/BIDQSQ
This Implementation provides a way that with minimal code you can remotely control where and how to show the ad inventory.
You will have full remote control over Ad Inventory configurations and with the addition of tags to your wrapper, you will have where you show the inventory.
This is the easiest monetization setup, because all configurations for the Units are done in the Remote Server, you just need to add the tags on the “white spaces of your app” where you might or might not place ads, so no need to manually request request the ads in those places.
This option is recommended under the following circumstances:
You App is native and you are able to add tags to your views
Wants to Disable and enable Inventory slots without updating the application.
Wants tos Edit the ad units remotely over the web without updating the application.
Wants to Change Formats, slot place, sizes, etc.
Manual Implementation
This is what you are looking for? continue here → https://refinery89.atlassian.net/wiki/x/BgDOSQ
This implementation is designed for situations where the Single tag might not align with your requirements, but you can still leverage the benefits of remote inventory configuration.
You can see an example in Android Demo Applications
Manual configuration means that you have remote control of General Ad Settings over the web or our tech support, but you need to add the ads manually, so instead of just placing the tags you need to create a wrapper and use it to do a request for the format that you want.
This option is recommended under the following circumstances:
Wants control over the logic of showing the Inventory.
You are using a framework that we don’t support but you can use native android code.
You have a web-application but you are not using our monetization in your web and want to place ads natively
Webview Implementation
This is what you are looking for? continue here → https://refinery89.atlassian.net/wiki/x/AgDlSQ
If your application is a web-application and your monetization is already in place in the web through our Header Tag or Adsense. It’s mandatory by google to have a native cmp when selling ad inventory on apps, use our sdk for sending consent from the phone to the cmp in the web view, this will improve performance metrics of the ad inventory in the web-application since now instead of web inventory it will be targeted as app.
This option is recommended under the following circumstances:
You have a web-application and you are using our web monetization tag and CMP
You need to send consent data to you web monetization solution (only our header bidding or adsense)
You need to properly target the ads inside the webview
You need to show ads both inside the webview and outside (combine with manual)
Remember that you should be using our CMP also in web so consent data can be understood.
If you are placing all or some ads natively, meaning that the actions on the web view trigger native code through some kind of javascript interface, then we recommend using Manual Implementation or if you are displaying some ads inside the webview and others in the native app you can use this implementation and manual together.
Comparison table
Feature | Manual | Single Tag | WebView |
---|---|---|---|
Integrated CMP. |
| ||
Custom auctions in R89 Servers. |
| ||
All Formats supported. | |||
Remote Unit Configs. |
| ||
Remote Ad Places. | |||
Local Testing without R89 DB or Servers. |
|
|