Known Indirect Subclasses |
Adapter for third party ad networks that support rewarded video ads.
The typical life-cycle for an adapter is to have
initialize(Context, MediationAdRequest, String, MediationRewardedVideoAdListener, Bundle,
Bundle)
called once. At this point the ad network should initialize itself and
report to the listener either
onInitializationSucceeded(MediationRewardedVideoAdAdapter)
or
onInitializationFailed(MediationRewardedVideoAdAdapter, int)
. Once the ad network
is initialized, the app will request rewarded video by invoking
loadAd(MediationAdRequest, Bundle, Bundle)
. At this point, the adapter should have
a rewarded video ad ready and report to the listener either
onAdLoaded(MediationRewardedVideoAdAdapter)
or
onAdFailedToLoad(MediationRewardedVideoAdAdapter, int)
. At the end of the life
cycle, a best effort is made to call onDestroy()
,
though this is not guaranteed. Note that
initialize(Context, MediationAdRequest, String, MediationRewardedVideoAdListener, Bundle,
Bundle)
and
loadAd(MediationAdRequest, Bundle, 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
MediationRewardedVideoAdListener
passed in the
initialize(Context, MediationAdRequest, String, MediationRewardedVideoAdListener, Bundle,
Bundle)
call. All parameters necessary to make an ad request should be passed in
serverParameters
, MediationAdRequest
,
and mediationExtras
parameters.
Adapters should make an effort to disable multiple reward for one ad.
Constant Summary
String | CUSTOM_EVENT_SERVER_PARAMETER_FIELD | The field in the serverParamters
bundle that contains the paramter for custom events. |
Public Method Summary
abstract void |
initialize(Context
context,
MediationAdRequest mediationAdRequest, String unused,
MediationRewardedVideoAdListener listener, Bundle
serverParameters, Bundle
networkExtras)
Adapter should initialize the ad network when this method is called, and report
to listener either
onInitializationSucceeded(MediationRewardedVideoAdAdapter) or
onInitializationFailed(MediationRewardedVideoAdAdapter, int) .
|
abstract boolean |
isInitialized()
Returns
true if the ad network has been initialized.
|
abstract void |
loadAd(MediationAdRequest
mediationAdRequest, Bundle
serverParameters, Bundle
networkExtras)
Requests a rewarded video ad.
|
abstract void |
showVideo()
Shows the rewarded video ad.
|
Inherited Method Summary
Constants
public static final String CUSTOM_EVENT_SERVER_PARAMETER_FIELD
The field in the serverParamters
bundle that contains the paramter for
custom events.
Public Methods
public abstract void initialize (Context context, MediationAdRequest mediationAdRequest, String unused, MediationRewardedVideoAdListener listener, Bundle serverParameters, Bundle networkExtras)
Adapter should initialize the ad network when this method is called, and report to
listener either
onInitializationSucceeded(MediationRewardedVideoAdAdapter)
or
onInitializationFailed(MediationRewardedVideoAdAdapter, int)
.
Parameters
context | The Context
of the rewarded video ad. The Activity
is preferred. |
---|---|
mediationAdRequest | Generic parameters for this publisher to use when making an ad request. |
unused | |
listener | Listener to adapter with callbacks for various events. |
serverParameters | Additional parameters defined by the publisher on the mediation server side. |
networkExtras | Additional parameters set by the publisher on a per-request basis. This is provided in initialize so that the mediated SDK may begin pre-loading ad requests. |
public abstract boolean isInitialized ()
Returns true
if the ad network has been initialized.
public abstract void loadAd (MediationAdRequest mediationAdRequest, Bundle serverParameters, Bundle networkExtras)
Requests a rewarded video ad. Adapter should invoke
onAdLoaded(MediationRewardedVideoAdAdapter)
when the ad is ready to be shown
or
onInitializationFailed(MediationRewardedVideoAdAdapter, int)
if there is no
rewarded video ad available.
Parameters
mediationAdRequest | Generic parameters for this publisher to use when making his ad request. |
---|---|
serverParameters | Additional parameters defined by the publisher on the mediation server side. |
networkExtras | Additional parameters set by the publisher on a per-request basis. |
public abstract void showVideo ()
Shows the rewarded video ad. This can be called any time after a call to
onAdLoaded(MediationRewardedVideoAdAdapter)