Meson supports Android version 4.4 (API Level 19) and above.
The download and use of the SDK are subject to the Meson SDK Licensing Terms. If you disagree with these terms, do not download, access, or use the SDK or the underlying services.
Ensure that all the executions are carried out on the main thread.
Meson supports both Gradle dependencies and manual download mechanisms to integrate Meson SDK.
Add the following to your project-level build.gradle
file inside the repositories section:
allprojects {
repositories {
mavenCentral()
. . .
}
}
On successful sync, you’ll be able to add any Android dependency hosted on mavenCentral repository to build.gradle. Add the Meson Prime SDK to your build.gradle dependencies:
implementation 'ai.meson.sdk:meson:1.0.0-beta35'
Copy the .AAR files to your application module’s libs/directory.
Add the following to your build.gradle file under the dependencies section.
implementation fileTree(dir: 'libs', include: ['*.aar'])
In addition to integrating the Meson Prime SDK, publishers using Meson Mediation must follow the instructions below to integrate desired third-party networks' SDKs into their apps:
If you are on the Amazon network, see Integrate Amazon SDK for more information.
Add mandatory dependencies, like Play Services, to allow GAID information to be retrieved to your build.gradle.
Add permissions to your Android manifest.
These permissions are not required for our SDK or 3rd-party SDKs to function, but including them in your AndroidManifest.xml may result in improved eCPM and user experience.
Exercise caution when accessing the manual SDK link, as it may include recent releases without compatibility and functionality testing. Utilizing the versions specified against each SDK is advisable, ensuring compatibility and reliable functionality.
For more information on the supported networks and their setup guides, see Network Guides.
Facebook Audience Network
|
Real-time CPM | Banner, Interstitial, MREC, Rewarded | Adapter | SDK | 6.13.7 | ||
InMobi Audience Bidding
|
Real-time CPM | Banner, Interstitial, MREC, Rewarded | Adapter | SDK | 10.6.7 | ||
Vungle
|
Real-time CPM | Banner, Interstitial, MREC, Rewarded | Adapter | SDK | 6.12.1 | ||
Mintegral
|
Real-time CPM | Banner, Interstitial, MREC, Rewarded | Adapter | SDK | 16.4.11 | ||
Unity | Predicted CPM | Banner, Interstitial, MREC, Rewarded | Adapter | SDK | 4.6.1 | ||
Applovin | Predicted CPM | Banner, Interstitial, MREC, Rewarded | Adapter | SDK | 11.11.3 | ||
Google Admob | Fixed CPM | Banner, Interstitial, MREC, Rewarded, Native | Adapter | SDK | 21.5.0 | ||
Google Ad Manager
|
Fixed CPM | Banner, Interstitial, MREC, Rewarded, Native | Adapter | SDK | 21.5.0 | ||
AdColony Advanced Bidding | Real-time CPM | Banner, Interstitial, MREC, Rewarded | Adapter | SDK | 4.8.0 | ||
Amazon Publisher Services | Real-time CPM | Banner, Interstitial, Rewarded | Adapter | SDK | 9.7.0 |
Add the following to your build.gradle file under the dependencies section.
implementation fileTree(dir: 'libs', include: ['*.aar, *.jar'])
Add additional dependencies like Play Services, to allow GAID information to be retrieved, to your build.gradle.
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
// Additional constraints for Google SDKs
// For apps targeting Android 12, add WorkManager dependency.
constraints {
implementation('androidx.work:work-runtime:2.7.0')
}
Add permissions to your Android manifest.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
// Admob and Ad Manager will need this in the manifest or the app will crash
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
These permissions are not required for our SDK or 3rd-party SDKs to function, but including them in your AndroidManifest.xml may result in improved eCPM and user experience
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Add the Kotlin dependencies to your build.gradle, if you are NOT using Kotlin for development.
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10"
implementation "androidx.core:core-ktx:1.3.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
This section is applicable only if you are using Android Gradle plugin 8.0 and above along with R8’s non-compat mode while pro guarding.
If your app’s build.gradle
has set “minifiyEnabled” equal to “true” and uses R8's non-compat mode, which means that full-mode is enabled, make sure to include the relevant ProGuard rules, if the third-party network library you use has direct or transitive dependencies on the libraries Gson, Retrofit, and Infer Annotation, as it is applicable. For more information , see R8 FAQs.
gson:
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName;
}
-keepclassmembers class MyDataClass {
!transient;
}
-keepattributes Signature
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class * extends com.google.gson.reflect.TypeToken
retrofit:
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
Facebook infer-annotation:
-dontwarn com.facebook.infer.annotation.Nullsafe$Mode
-dontwarn com.facebook.infer.annotation.Nullsafe
MesonSdkConfiguration.Builder.setConsent(consent: JSONObject?)
- This will be removed in a future version.MesonSdkConfiguration.Builder.setBuildType(buildType: BaseMesonInit.MesonBuildType)
- This will be removed in a future version.Use the MesonSdkConfiguration
object to initialize the SDK. The listener object is optional.
Follow the instructions below to initialize the SDK:
MesonSdkClass
. You must initialize the SDK successfully before carrying out any other operations.
//Set your configuration with your application context and APP ID.
val mesonSdkConfiguration = MesonSdkConfiguration.Builder(this, "<MESON_APP_ID>").build()
//Init SDK
MesonSdk.initialize(mesonSdkConfiguration, object : MesonSdkInitializationListener {
override fun onComplete(error: Error?) {
if(error == null) {
//Init Success, Ad Integrations may start here.
} else {
//Init Failed, Please check the Error Message.
}
}
})
//Set your configuration with your application context and APP ID.
MesonSdkConfiguration mesonSdkConfiguration = new MesonSdkConfiguration.Builder(this, "<MESON_APP_ID>").build();
//Init SDK
MesonSdk.Companion.initialize(mesonSdkConfiguration, new MesonSdkInitializationListener() {
@Override
public void onComplete(@Nullable Error error) {
if(error == null) {
//Init Success, Ad Integrations may start here.
} else {
//Init Failed, Please check the Error Message.
}
}
});
isSDKInitialized
.
//Optionally you can check our api MesonSdk.isSDKInitialized()
if(MesonSdk.isSDKInitialized()) {
//Initialised is true
} else {
//Initialised is false
}
//Optionally you can check our api MesonSdk.Companion.isSDKInitialized();
if(MesonSdk.Companion.isSDKInitialized()) {
//Initialised is true
} else {
//Initialised is false
}
When logging is set to DEBUG, SDK will print key logs to the DDMS console that provide useful information about the initialization and bid request lifecycle.
MesonSdk.setLogLevel(LogLevel.DEBUG)
MesonSdk.Companion.setLogLevel(BaseMesonInit.LogLevel.DEBUG);