Single Line Integration of Media.Net Header Bidder for DFP & MoPub

You will need to go through the steps in our Getting Started Guide to add Media.Net SDK into your project before starting the integration of Header Bidder for DFP.

##Follow these simple steps for the integration:

There are 3 steps in total to get DFP as a partner in your header bidder stack. The first step is to add Media.Net dependencies to your main Gradle file. The second step is to apply the Media.Net plugin to your Main Gradle file. The third and the final step is to

NOTE: Depending on the version of the Gradle plugin you have for your project the First and Second steps are different. For Gradle Plugin Version below 3.0.0, which is most videly used, the steps are mentioned first and later for Gradle Version 3.0.0 and above.

##Gradle File Version Below 3.0.0

###First: Add the following dependency to your main Gradle file

Add the below mentioned dependency to your main Gradle file as shown in the image.

   dependencies {
    classpath "net.media.android:plugin:0.0.3"
   }

###Second: Apply the plugin to your application Gradle file.

Add the below mentioned plugin to your application Gradle file as shown in the image.

   apply plugin: "net.media.android.plugin"

##Gradle File Version 3.0.0 and above

###First: Add the following dependency to your main Gradle file

Add the below mentioned dependency to your main Gradle file as shown in the image.

   dependencies {
    classpath "net.media.android:plugin:0.0.3"
   }

###Second: Apply the plugin to your application Gradle file.

Add the below mentioned plugin to your application Gradle file as shown in the image.

   apply plugin: "net.media.android.plugin"

###Third and finally: Add the below single-line code to your application Gradle file.

   compile "net.media.android:google-ads:1.2.5"

###Passing custom data through DFP Header Bidder

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();