com.google.ads.mediation.admob
Class AdMobAdapter

java.lang.Object
  extended by com.google.ads.mediation.admob.AdMobAdapter
All Implemented Interfaces:
MediationAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>, MediationBannerAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>, MediationInterstitialAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>

public class AdMobAdapter
extends Object
implements MediationBannerAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>, MediationInterstitialAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>

AdMob Adapter for AdMob Mediation.


Constructor Summary
AdMobAdapter()
           
 
Method Summary
 void destroy()
          Destroys the adapter.
 Class<AdMobAdapterExtras> getAdditionalParametersType()
          Provides the class that supplies publisher extras.
 View getBannerView()
          Returns the ad View for banner ads.
 Class<AdMobAdapterServerParameters> getServerParametersType()
          Provides the class that supplies server parameters.
 void requestBannerAd(MediationBannerListener listener, Activity activity, AdMobAdapterServerParameters serverParameters, AdSize adSize, MediationAdRequest mediationAdRequest, AdMobAdapterExtras extras)
          Called by the mediation library to request an ad from the adapter.
 void requestInterstitialAd(MediationInterstitialListener listener, Activity activity, AdMobAdapterServerParameters serverParameters, MediationAdRequest mediationAdRequest, AdMobAdapterExtras extras)
          Called by the mediation library to request an ad from the adapter.
 void showInterstitial()
          Shows the interstitial.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdMobAdapter

public AdMobAdapter()
Method Detail

getAdditionalParametersType

public Class<AdMobAdapterExtras> getAdditionalParametersType()
Provides the class that supplies publisher extras.

Specified by:
getAdditionalParametersType in interface MediationAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>

getServerParametersType

public Class<AdMobAdapterServerParameters> getServerParametersType()
Provides the class that supplies server parameters.

Specified by:
getServerParametersType in interface MediationAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>

requestBannerAd

public void requestBannerAd(MediationBannerListener listener,
                            Activity activity,
                            AdMobAdapterServerParameters serverParameters,
                            AdSize adSize,
                            MediationAdRequest mediationAdRequest,
                            AdMobAdapterExtras extras)
Description copied from interface: MediationBannerAdapter
Called by the mediation library to request an ad from the adapter.

If the request is successful, the MediationBannerListener.onReceivedAd(com.google.ads.mediation.MediationBannerAdapter) method should be called.

If the request is unsuccessful, the MediationBannerListener.onFailedToReceiveAd(com.google.ads.mediation.MediationBannerAdapter, com.google.ads.AdRequest.ErrorCode) method should be called on the listener with an appropriate error cause.

This method is called on the UI thread so all the standard precautions of writing code on that thread apply. In particular your code should not call any blocking methods.

Specified by:
requestBannerAd in interface MediationBannerAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>
Parameters:
listener - Listener to adapter with callbacks for various events
activity - Android Activity which is displaying the ad
serverParameters - Additional parameters defined by the publisher on the mediation server side
adSize - The size of the ad to fetch. The ad size returned should have size as close as possible to the size specified in this parameter. If this ad size is not supported the request should fail and MediationAdapterListener.onFailedToReceiveAd should be called.
mediationAdRequest - Generic parameters for this publisher to use when making his ad request
extras - Additional parameters set by the publisher on a per-request basis

getBannerView

public View getBannerView()
Returns the ad View for banner ads.

Specified by:
getBannerView in interface MediationBannerAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>

destroy

public void destroy()
Destroys the adapter.

Specified by:
destroy in interface MediationAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>

requestInterstitialAd

public void requestInterstitialAd(MediationInterstitialListener listener,
                                  Activity activity,
                                  AdMobAdapterServerParameters serverParameters,
                                  MediationAdRequest mediationAdRequest,
                                  AdMobAdapterExtras extras)
Description copied from interface: MediationInterstitialAdapter
Called by the mediation library to request an ad from the adapter.

If the request is successful, the MediationInterstitialListener.onReceivedAd(com.google.ads.mediation.MediationInterstitialAdapter) method should be called. The interstitial should *NOT* be automatically shown at this point. The mediation library will call the MediationInterstitialAdapter.showInterstitial() method when the interstitial should be shown.

If the request is unsuccessful, the MediationInterstitialListener.onFailedToReceiveAd(com.google.ads.mediation.MediationInterstitialAdapter, com.google.ads.AdRequest.ErrorCode) method should be called on the listener with an appropriate error cause.

Note that this method is called on the UI thread, so all the general precautions of writing code on that thread apply. In particular, the code should not call any blocking methods.

Specified by:
requestInterstitialAd in interface MediationInterstitialAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>
Parameters:
listener - Listener to adapter with callbacks for various events
activity - Android Activity which is displaying the ad
serverParameters - Additional parameters defined by the publisher on the mediation server side
mediationAdRequest - Generic parameters for this publisher to use when making his ad request
extras - Additional parameters set by the publisher on a per-request basis

showInterstitial

public void showInterstitial()
Description copied from interface: MediationInterstitialAdapter
Shows the interstitial. This may be called any time after a call to MediationInterstitialListener.onReceivedAd(com.google.ads.mediation.MediationInterstitialAdapter).

Specified by:
showInterstitial in interface MediationInterstitialAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>