Adapter for DFP Mobile Ads SDK for Android

Follow this guide to add Media.Net Android SDK to DFP mediation layer. The Media.Net adapter allows the inclusion of Media.Net ads in DFP mediation.

Go through the steps in our Getting Started Guide to add Media.Net SDK into your project before starting the integration.

Overview of DFP Adapter Mediation

In this configuration, your application talks to the DFP SDK, which in turn requests content from the Media.Net SDK. See below diagram of the flow of information from Media.Net - DFP adapter mediation:

Media.Net SDK Instructions

Requirements:

  • Media.Net SDK
  • DFP SDK (The minimum version tested is 9.6.1)

Before Getting Started:

  • Make sure that your app has the DFP SDK and is registered in your DFP account.
  • Your app has configured the Banner and/or interstitial Ad Units.
  • You have read through DFP getting started guide for Android.
  • You have the Media.Net dashboard account and ‘Customer ID’ for the app where you want to run ads.

Integrating Media.Net Adapter into your Android App

Update the app level build.gradle as follows:

   dependencies {
	 compile 'net.media.android:google-ads:1.2.5'
   }

Media.Net Network Setup in DFP

Follow the instructions below to add MNet as an Ad Network through DFP dashboard:

1) Click on Delivery from the menu bar on the top of your DFP account dashboard. Then select Yield groups from the list of menu on the left.

2) In the next screen click on CREATE YIELD GROUP if you don’t have already created one. Follow the guide here to add a mediation group.

3) Once the mediation group is created, click on the down arrow for the mediation group as shown in the figure below.

4) From the following screen click on EDIT.

5) In the following screen click on ADD ANOTHER NETWORK.

6) Next from the drop down for Mediation Network, select Create a new mediation network.

7) In the popup screen, search for other network from the Ad network dropdown. Then add your prefered name for MNet ads network and click save.

8) You will then have to select the Operating system from the drop down. Then fill in the Class Name and Parameter fields which will be provided to you by your MNet account manager.

Passing custom data through DFP Mediation Adapter

Custom data like user-details, location-details and context-link can be sent into the AdRequest object, through certain parameters, which will be picked up by the MNet ad-views to contextualize the mediation-ads.

NOTE: this process is equivalent in both Banner and Interstitial ads.

Here is an example for setting the user and location details in the AdRequest object

    final AdRequest adRequest = new AdRequest.Builder()
         .setLocation(location)
         .setGender(AdRequest.GENDER_FEMALE)
         .setBirthday(date)
         .setContentUrl(contentUrl)
         .build();