public class AdMobAdapter extends Object implements MediationBannerAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>, MediationInterstitialAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>
Constructor and Description |
---|
AdMobAdapter() |
Modifier and Type | Method and Description |
---|---|
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.
|
public Class<AdMobAdapterExtras> getAdditionalParametersType()
getAdditionalParametersType
in interface MediationAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>
public Class<AdMobAdapterServerParameters> getServerParametersType()
getServerParametersType
in interface MediationAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>
public void requestBannerAd(MediationBannerListener listener, Activity activity, AdMobAdapterServerParameters serverParameters, AdSize adSize, MediationAdRequest mediationAdRequest, AdMobAdapterExtras extras)
MediationBannerAdapter
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.
requestBannerAd
in interface MediationBannerAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>
listener
- Listener to adapter with callbacks for various eventsactivity
- Android Activity which is displaying the adserverParameters
- Additional parameters defined by the publisher on the mediation server
sideadSize
- 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 MediationBannerListener.onFailedToReceiveAd(com.google.ads.mediation.MediationBannerAdapter<?, ?>, com.google.ads.AdRequest.ErrorCode)
should be
called.mediationAdRequest
- Generic parameters for this publisher to use when making his ad
requestextras
- Additional parameters set by the publisher on a per-request basispublic View getBannerView()
getBannerView
in interface MediationBannerAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>
public void destroy()
destroy
in interface MediationAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>
public void requestInterstitialAd(MediationInterstitialListener listener, Activity activity, AdMobAdapterServerParameters serverParameters, MediationAdRequest mediationAdRequest, AdMobAdapterExtras extras)
MediationInterstitialAdapter
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.
requestInterstitialAd
in interface MediationInterstitialAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>
listener
- Listener to adapter with callbacks for various eventsactivity
- Android Activity which is displaying the adserverParameters
- Additional parameters defined by the publisher on the mediation
server sidemediationAdRequest
- Generic parameters for this publisher to use when making his ad
requestextras
- Additional parameters set by the publisher on a per-request basispublic void showInterstitial()
MediationInterstitialAdapter
MediationInterstitialListener.onReceivedAd(com.google.ads.mediation.MediationInterstitialAdapter<?, ?>)
.showInterstitial
in interface MediationInterstitialAdapter<AdMobAdapterExtras,AdMobAdapterServerParameters>