Getting started
Android app requirements:
-
minSdkVersion
: 21 or higher -
compileSdkVersion
: 34 or higher -
Android Gradle Plugin:
4.1.*
or higher
Add XMediator to your Android project
X3M's Maven repository
In the project level gradle configuration file, include X3M's Maven repository:
Token based repository deprecation notice
If you are using the deprecated https://YOUR_MAVEN_TOKEN.artifact-registry.x3mads.com/maven
along with the deprecated package domains com.etermax.android.xmediator*
, please migrate to the new repository and package domain:
https://YOUR_MAVEN_TOKEN.artifact-registry.x3mads.com/maven
tohttps://android-artifact-registry.x3mads.com/maven
com.etermax.android.xmediator
tocom.x3mads.android.xmediator
We'll continue supporting the old repository in the short term, to maintain compatibility with already integrated projects. Please consider migrating as soon as posible to avoid running into issues in the future.
XMediator Core dependency
In the app-level gradle configuration file, add the following dependency:
Add your Google Ads App Id to the Android Manifest
XMediator utilizes Google Ads services to obtain the GAID (Google Advertising ID) required by some mediation networks to serve ads.
In your app's manifest add the following metadata with your own Google Ads App ID:
Mediation adapters
To integrate additional mediation network adapters, add the corresponding dependency in the app level gradle file. You may also need to add additional maven repositories dependending on the network.
For instance, here is how to add the Google Ads mediation adapter for XMediator:
You can find the dependencies required for each network in the changelogs of the adapters. For a complete list of supported ad partners please refer to Supported ad networks.
Choose networks
Pick networks to generate a code snippet for your build.gradle file:
Initialize the SDK
Before requesting any ad, make sure to call XMediatorAds.startWith()
. This method configures your application Key, and fetches the required configuration parameters for the ad placements in your app, among other things.
Additionally, you may want to wait for the initialization callback to complete. This will ensure that your placement' requests have the necessary prebid configurations.
You may also configure additional options using the InitSettings
instance in the initialize method.
For a complete list of available options please see InitSettings Class
Warning
To ensure the SDK is correctly configured before ad mediation begins, any method that performs an ad request will raise an exception if they are called before XMediatorAds.startWith()
is invoked.
It is mandatory to wait for the init callback to complete before making any ad request.