1. Android – Monetize ...
  2. Use Manual
  3. Commencer

Commencer

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 of 19 or higher
    • A compileSdkVersion of 33 or higher

App Configuration

1. Gradle Dependencies

Check for the latest version here

Gradle buildscript

Project build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }
}

App/Module level build gradle:

dependencies {
    implementation ("com.refinery89.androidsdk:sharedCore-android:x.x.x")
}

Gradle version catalogs

In app/module level build gradle:

dependencies {
    implementation (libs.r89sdk)
}

and in libs.versions

[versions]
r89sdk = "x.x.x"
            
[libraries]
r89sdk = { module = "com.refinery89.androidsdk:mobile", 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 this code to the manifest inside the <application> tag:

<meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="<the-google-id>" />
  • Test: Use "ca-app-pub-3940256099942544~3347511713" for <the-google-id> this is from
    google official docs

  • Production: Use your own Google Id provided by us for <the-google-id>.
    If you have your own Google ID, follow these steps in the ‘Find the Google Mobile Ads Application IDs‘ section.

 

Simplified example would look something like:

<manifest>
                
    <application>
                
        <!-- The value is the test id from Google ad manager docs --/&gt
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="<the-google-id>" />
                
        <!-- Other activities and components --/&gt
        <activity
            ...
        </activity>
                
        ...
                
    </application>
                
</manifest>

4.Create an APP class

Create an Application class and add to the manifest code to start the application
with the Application class.

Create a class following the structure below and replace the <replace one of the examples here> for one
example available in Init Examples.

SDK needs to be initialized only once and as early in app lifecycle as possible. For that we recommend you use Application class. Or, if your app has only one Activity, lifecycle of which matches the lifecycle of Application, you can initialize it in onCreate method of that Activity.

 

class Application : Application() {
    override fun onCreate() {
        super.onCreate()
        <replace one of the examples here>
    }
}

4.1 Specify in the manifest to execute the app class

Add Property android:name= "<packageName>.<className>" to application. In
our case, the Application.kt file is in the
root package so it is just .Application.

This is what the manifest should have added:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
            
    <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" />
            
        <application
            ...
            android:name=".Application"
            ...>
            
            <meta-data
                android:name="com.google.android.gms.ads.APPLICATION_ID"
                android:value="ca-app-pub-3940256099942544~3347511713" />
            
        </application>
            
</manifest>

4.2 Choose Initialization type

There are a couple of ways to initialize the SDK. Use JUST ONE of them.

 

To choose, you have the comparison page ou veuillez nous contacter.

  • Test: Use any of the examples provided in the tutorials.

  • Production: Use the Template at the end of each tutorial.

Manual Initialization

Make sure to follow the Manual Initialization tutorial.

Template: Link.

Single Tag Initialization

Make sure to follow the Single tag initialization tutorial.

Template: Link.

If your application uses or you want to use minify, please follow these instructions.

Formats Available

Comment pouvons-nous aider ?