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

Do 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 or MoPub.

Follow these simple steps for the integration:

First, add the following dependency to your main Gradle file.

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

Second, apply the plugin to your application Gradle file.

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

Third and finally, add the below single-line code to your application Gradle file depending upon your preference. You can always add both.

For DFP

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

For MoPub

   compile "net.media.android:mopub:1.2.5"