Mediate via AdMob on Android

The Flurry AdMob and DFP mediation adapter lets you integrate ads from the Flurry network, via the Flurry Advertising SDKs, into the Google Mobile Ads mediation platform.

To start the mediation integration, ensure that you have access to the following:


Note that this section describes mediation of Flurry through AdMob. For DFP mediation of Flurry inventory, follow these Integration instructions.

Get Started Mediating Flurry via AdMob

To integrate Flurry as the mediated network in AdMob ad serving, you perform the following tasks:

  1. Integrate Flurry SDK and Flurry adapter for AdMob code into your app.
  2. Configure Flurry’s Ad Unit(s).
  3. Configure AdMob to mediate Flurry.
  4. Request ads in your app.

Integrate Flurry SDK and Flurry Adapter Into Your App

Follow these steps:

  1. If your app is not currently tracked by Flurry, create a new application on Flurry’s developer portal.
  2. Keep a reference to the API Key for the new application after it has been created. Flurry requires each application to have its own unique API key to identify your app in the Flurry system. The Flurry API key is also used when configuring mediation on the AdMob/DFP dashboard.
  3. Add the latest Flurry Android SDK into your app.
  4. To integrate the Flurry adapter into your application code, add the adapter as a dependency in your project (available here).

Flurry requires you add the Google Play Services SDK to your project. (If you haven’t already done so as required for Google Ads SDK, see the detailed Google instructions on AdMob integration that cover this step: AdMob Integration.)

  1. Modify your project’s manifest file to include FlurryFullscreenTakeoverActivity.

<activity
    android:name="com.flurry.android.FlurryFullscreenTakeoverActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
</activity>
  1. If using Proguard, update your Proguard configuration to include the following:

keep class com.flurry.** { *; }
­dontwarn com.flurry.**
­keepattributes *Annotation*,EnclosingMethod ­keepclasseswithmembers class * {
     public <init>(android.content.Context, android.util.AttributeSet, int); }

# Preserve Flurry mediation classes for DFP/AdMob Ads ­keep public class com.google.ads.mediation.flurry.**
# Google Play Services library

­keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents(); }

­keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
      public static final *** NULL; }
­keepnames @com.google.android.gms.common.annotation.KeepName class * ­keepclassmembernames class * {
           @com.google.android.gms.common.annotation.KeepName *; }
­keepnames class * implements android.os.Parcelable { public static final ** CREATOR;
}

Further instructions for including mediation into your AdMob ad serving flow are available at Mediation: Publishers Quick Start.

Configure Flurry’s Ad Unit(s)

Follow these steps:

  1. For each AdMob ad unit that you want to mediate Flurry through, create a matching ad unit on the Flurry developer portal.
  2. Log in to the developer portal and navigate to the Monetization tab. On the left navigation bar select Applications & Ad Units.
  3. You may see a list of previously created ad units. To set up a new one, click the Ad Unit button in the upper-left corner. Depending on the type of Ad Unit you are creating, the Ad Unit setup screen has three to four modules. The Basic Setup section includes fields required to define the name, application, dimensions, placement and orientation of the ad unit.
  4. You only need the basic setup to start. Click Save.

For additional ad unit configuration information, see Basic Ad Unit Setup instructions and Advanced Configuration instructions.

You are required to create your Ad Unit on the developer portal before retrieving ads through mediation.

Mediating Flurry through AdMob requires no additional Flurry-related code in your application. The Flurry Ad Unit invocation code is already incorporated in the adapter code.

If you are integrating banner ads, Flurry recommends that you turn off banner refresh in Flurry and let AdMob refresh the ads. Set the refresh rate for the Ad Unit to an unusually high number, like 9999 (instead of the default 30 seconds). This setting is found in the Advanced Options section of the Ad Unit setup.

Configure AdMob to Mediate Flurry

Follow these steps:

  1. On the Google AdMob site, configure Flurry mediation.
  2. For each ad unit that you would like to mediate Flurry through, select the Edit mediation link.
AdMob mediates Flurry

  1. Choose Flurry from the list of available ad networks. Once Flurry is selected, provide the API key and ad space that you configured in the earlier step.
AdMob configure Flurry

  1. Capture the Ad unit ID.

Use this ID in your code to retrieve ads from AdMob, Flurry and any other networks configured in this step.


Request Ads in your App

Follow the same instructions used for integrating AdMob ads into your application. To integrate non-interstitial ads (banner size, leaderboard size, and so on), follow the AdMob instructions for banner ads from Google. To integrate interstitial ads (full-screen ads that take over the screen), follow the AdMob instructions for interstitial ads from Google.

To integrate native ads, follow the instructions for AdMob from Google for native ads. The Google Ads SDK allows the mediation of two system-defined native ad formats: Content and App-install ad formats. Publishers mediating Flurry can request for both formats.

Note: Ad requests for only App-install ads will not work during Flurry mediation. We recommend that publishers request for both formats if mediating Flurry.

Examples

Configuring the AdMob ad request with extra configuration options from Flurry:

Bundle flurryExtras = new Bundle(1);
// Set an extra to enable Flurry SDK debug logs
flurryExtras.putBoolean(FlurryAdapter.SERVER_PARAM_LOG_ENABLED, true);

AdRequest.Builder builder = new AdRequest.Builder()
        .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
        .addNetworkExtrasBundle(FlurryAdapter.class, flurryExtras);

AdRequest adRequest = builder.build();

AdMob ad request for banner or interstitial ads:

// Create the banner ad view
AdView bannerAdView = new AdView(mActivityContext);

// Add the bannerAdView to your layout hierarchy
// ..

// Load the banner ad with the previously created ad request
bannerAdView.setAdUnitId(ADMOB_MEDIATED_AD_UNIT);
bannerAdView.setAdListener(this);
bannerAdView.loadAd(adRequest);

// Create and load the interstitial ad
InterstitialAd interstitialAd = new InterstitialAd(mActivityContext);
interstitialAd.setAdUnitId(ADMOB_MEDIATED_AD_UNIT);
interstitialAd.setAdListener(this);
interstitialAd.loadAd(adRequest);

//..

// After the ad has been loaded, show it on screen
interstitialAd.show();

To learn about making AdMob native ad requests, follow the instructions provided by Google. After completing a successful native ad request, you can get Flurry-specific assets in the following way:

/*
 Get the native ad's branding logo URL. This asset is also available
 for app-install ads.
 */
String brandingLogoUrl = ((NativeContentAd) nativeAd).getExtras()
            .getString(FlurryAdapter.EXTRA_BRANDING_LOGO);

// Get the native app-install ad's app category
String appCategory = ((NativeAppInstallAd) nativeAd).getExtras()
            .getString(FlurryAdapter.EXTRA_APP_CATEGORY);