This guide is intended for publishers who are interested in using Google Mobile Ads mediation with Flurry. It walks through the setup of a mediation adapter to work with your current Android app and the configuration of additional settings.
An Android app with the Google Mobile Ads SDK integrated. (If you don't have one, see Get Started.)
A Google Ad Manager account with Mediation for mobile apps configured.
Add Flurry to your project
Include network adapter and SDK
Download the Flurry SDK and adapter from the links above.
In Android Studio, include the JAR files in your project's
folder. Make sure that your
build.gradle file includes the following:
implementation fileTree(dir: 'libs', include: ['*.jar'])
Configure the AndroidManifest.xml file
AndroidManifest.xml file as instructed in the Flurry
Your app doesn't need to call Flurry directly—the Google Mobile Ads SDK calls the Flurry adapter to fetch ads on your behalf. If you don't wish to specify any additional request parameters, then you're done! The rest of this page details how to provide more information to Flurry.
Initialize your ad object with an Activity instance
In the constructor for a new ad object (for example,
you must pass in an object of type
Context is passed on to other ad networks when using mediation. Some
ad networks require a more restrictive
Context that is of type
and may not be able to serve ads without an
Activity instance. Therefore,
we recommend passing in an
Activity instance when initializing ad objects
to ensure a consistent experience with your mediated ad networks.
Specify additional request parameters (Optional)
You can optionally add targeting information (such as location, birthday, gender, and COPPA preferences) that can be used by networks to serve more finely targeted ads.
If a user has granted your app location permissions, Ad Manager automatically passes this location data to the SDK. The SDK uses this data to improve ad targeting without requiring any code changes in your app.
Auto-populated location information is not forwarded to mediation networks and
auto-location may be disabled entirely. Therefore, the SDK provides the ability
to set location manually in the
PublisherAdRequest. In this example, the
location is set before loading the ad request:
Location location = new Location(""); // New York location.setLatitude(40.764316); location.setLongitude(-73.977245); location.setAccuracy(100); PublisherAdRequest request = new PublisherAdRequest.Builder() .setLocation(location) .build();
Out of respect for user privacy, Google asks that you specify location only if that information is already being used by your app.
You can optionally add demographic targeting information such as user's gender
and birthday to your
This information can be used by networks to serve more finely targeted ads.
Ad Manager provides methods for setting gender and birthday. These are passed along to all networks that accept them. Here is an example:
PublisherAdRequest request = new PublisherAdRequest.Builder() .setGender(PublisherAdRequest.GENDER_FEMALE) .setBirthday(new GregorianCalendar(1985, 0, 1).getTime()) // January 1, 1985 .build();