This interface is deprecated.
Use Adapter
instead.
Adapter for third party ad networks that support banner ads.
The typical life-cycle for an adapter is to have
requestBannerAd(Context, MediationBannerListener, Bundle, AdSize, MediationAdRequest,
Bundle)
called once. At this point the adapter should request an ad from the ad
network and report to the listener either
MediationBannerListener.onAdLoaded(MediationBannerAdapter)
or
MediationBannerListener.onAdFailedToLoad(MediationBannerAdapter, AdError)
.
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
MediationAdapter.onDestroy()
, though this is not guaranteed. Note that
requestBannerAd(Context, MediationBannerListener, Bundle, AdSize, 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 expose events via the MediationBannerListener
passed in the
requestBannerAd(Context, MediationBannerListener, Bundle, AdSize, 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 Method Summary
abstract View |
getBannerView()
Returns a
View that
can be rendered to display the ad.
|
abstract void |
requestBannerAd(Context
context,
MediationBannerListener listener, Bundle
serverParameters, AdSize
adSize,
MediationAdRequest mediationAdRequest, Bundle
mediationExtras)
Called by the mediation library to request a banner ad from the adapter.
|
Inherited Method Summary
Public Methods
public abstract View getBannerView ()
Returns a View
that can be
rendered to display the ad.
This must not be null after a
requestBannerAd(Context, MediationBannerListener, Bundle, AdSize, MediationAdRequest,
Bundle)
call and before a
MediationAdapter.onDestroy()
call. It may be null any other time.
public abstract void requestBannerAd (Context context, MediationBannerListener listener, Bundle serverParameters, AdSize adSize, MediationAdRequest mediationAdRequest, Bundle mediationExtras)
Called by the mediation library to request a banner ad from the adapter.
If the request is successful, the
MediationBannerListener.onAdLoaded(MediationBannerAdapter)
method should be
called.
If the request is unsuccessful, the
MediationBannerListener.onAdFailedToLoad(MediationBannerAdapter, AdError)
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.
Parameters
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 |
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
MediationBannerListener.onAdFailedToLoad(MediationBannerAdapter,
AdError) should be called. |
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 |