AdMob

The YaftaMobile AdMob Custom Event allows AdMob publishers to add YaftaMobile as a Custom Ad Network within the AdMob platform.

Prerequisites

  • You already know how to integrate and use Google AdMob SDK into your application.
  • Have already setup your application and ad units on AdMob interface.

Step 1: Integrate the YaftaMobile Adapter and SDK into your project

The YaftaMobile Adapter and SDK are available as an AAR via mavenCentral

Add this to Module-level /app/build.gradle before dependencies:

repositories {
    mavenCentral() 
}

Then add the compile dependencies:

dependencies {
  implementation 'com.mustamara.android:yaftamobile-android-sdk:3.0.0'
  implementation 'com.mustamara.android:yaftamobile-admob-adapter:2.0.1'
}

Step 2: Update your Android Manifest

Your AndroidManifest.xml will need to be updated in order to complete the SDK integration.

In AndroidManifest.xml, declare the following permissions:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Then declare your AppID Meta-data:

<meta-data android:name="com.mustamara.yaftamobile.sdk.appid" 
android:value="<YOUR-APPID>"
/>

And add the following activity (Only for Interstitial Ad) :

<activity
android:name="com.mustamara.yaftamobile.sdk.ads.interstitial.InterstitialActivity"
android:configChanges="keyboard|keyboardHidden|orientation" />

Step 3: Configure AdMob to mediate YaftaMobile

First you need to define a custom event that points to the specific class in your application through the AdMob interface. Follow these instructions to create a custom event.

  1. Click Mediation in the side bar and CREATE MEDIATION GROUP.
  2. Select the corresponding Ad Format and Platform that will be used in the mediation., and click CONTINUE.
  3. Fill in the “Mediation Group Name” field.
  4. Click on ADD AD UNITS and add the Ad Unit that will be mediating to YaftaMobile.
  5. Click ADD CUSTOM EVENT in the ad sources table
  6. Fill in the Label field. and eCPM for your Custom Event, and click CONTINUE
  7. Add Custom Event Class Name com.mustamara.yaftamobile.sdk.mediation. admob.YaftaMobileAdMobAdapter
  8. Click on Done.
  9. Click on Save and you’re done.

Step 4: Request Ads

Follow AdMob’s instructions to request banner or interstitial ads, but using ad units that you created in Step 3 above.