Android Open Source - mantis-android-admob Mediation






From Project

Back to project page mantis-android-admob.

License

The source code is released under:

MIT License

If you think the Android project mantis-android-admob listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.mantisadnetwork.android.admob;
/*  w  ww  .  ja  va2 s  .  c o m*/
import android.app.Activity;

import com.google.ads.AdSize;
import com.google.ads.mediation.MediationAdRequest;
import com.google.ads.mediation.customevent.CustomEventBanner;
import com.google.ads.mediation.customevent.CustomEventBannerListener;

public class Mediation implements CustomEventBanner {
  @Override
  public void requestBannerAd(CustomEventBannerListener listener, Activity activity, String label,
      String serverParameter, AdSize size, MediationAdRequest request, Object customEventExtra) {

    UserContext context = new UserContext();

    if (request.getLocation() != null) {
      context.setLatitude(request.getLocation().getLatitude());
      context.setLongitude(request.getLocation().getLatitude());
    }

    if (request.getAgeInYears() != null) {
      context.setAge(request.getAgeInYears());
    }

    AdRequestTask task = new AdRequestTask(activity, listener, serverParameter, context);
    task.execute();
  }

  @Override
  public void destroy() {
  }

}




Java Source Code List

com.mantisadnetwork.android.admob.AdRequestTask.java
com.mantisadnetwork.android.admob.AdRequest.java
com.mantisadnetwork.android.admob.AdResponse.java
com.mantisadnetwork.android.admob.Ad.java
com.mantisadnetwork.android.admob.Context.java
com.mantisadnetwork.android.admob.Mediation.java
com.mantisadnetwork.android.admob.UserContext.java