com.google.android.gms.ads.mediation.MediationInterstitialAdapter |
Adapter for third party ad networks that support interstitial ads.
The typical life-cycle for an adapter is to have requestInterstitialAd(Context, MediationInterstitialListener, Bundle, MediationAdRequest, Bundle)
called once.
At this point the adapter should request an ad from the ad network and report to the listener
either onAdLoaded(MediationInterstitialAdapter)
or
onAdFailedToLoad(MediationInterstitialAdapter, int)
. Subsequent requests will be made
with a new instance of the adapter. At the end of the life cycle, a best effort is made to call
onDestroy()
, though this is not guaranteed. Note that requestInterstitialAd(Context, MediationInterstitialListener, Bundle, MediationAdRequest, Bundle)
is
called on the UI thread so all the standard precautions of writing code on that thread apply.
In particular, the code should not call any blocking methods.
The adapter is expected to forward events via the MediationInterstitialListener
passed
in the requestInterstitialAd(Context, MediationInterstitialListener, Bundle, MediationAdRequest, Bundle)
call. All parameters necessary to make an ad request
should be passed in the serverParameters
, MediationAdRequest
, and
mediationExtras
parameters.
Adapters should make an effort to disable automatic ad refreshing on the client side. Ads that are refreshed may be ignored, not displayed, and counted incorrectly.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called by the mediation library to request an ad from the adapter.
| |||||||||||
Shows the interstitial.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Called by the mediation library to request an ad from the adapter.
If the request is successful, the
onAdLoaded(MediationInterstitialAdapter)
method should be called. The interstitial
should *NOT* be automatically shown at this point. The mediation library will call the
showInterstitial()
method when the interstitial should be shown.
If the request is unsuccessful, the
onAdFailedToLoad(MediationInterstitialAdapter, int)
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.
context | The Context of the AdView which will contain the banner View. The
Activity is preferred. |
---|---|
listener | Listener to adapter with callbacks for various events |
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 |
mediationExtras | Additional parameters set by the publisher on a per-request basis |
Shows the interstitial. This may be called any time after a call to
onAdLoaded(MediationInterstitialAdapter)
.