com.google.android.gms.ads.reward.mediation.MediationRewardedVideoAdAdapter |
![]() |
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.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | CUSTOM_EVENT_SERVER_PARAMETER_FIELD | The field in the serverParamters bundle that contains the paramter for custom events. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adapter should initialize the ad network when this method is called, and report to listener
either
onInitializationSucceeded(MediationRewardedVideoAdAdapter) or onInitializationFailed(MediationRewardedVideoAdAdapter, int) . | |||||||||||
Returns
true if the ad network has been initialized. | |||||||||||
Requests a rewarded video ad.
| |||||||||||
Shows the rewarded video ad.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
The field in the serverParamters
bundle that contains the paramter for custom events.
Adapter should initialize the ad network when this method is called, and report to listener
either onInitializationSucceeded(MediationRewardedVideoAdAdapter)
or onInitializationFailed(MediationRewardedVideoAdAdapter, int)
.
Parameters | |
---|---|
context |
Context :
The Context of the rewarded video ad. The Activity
is preferred. |
mediationAdRequest |
MediationAdRequest :
Generic parameters for this publisher to use when making an ad
request. |
unused |
String
|
listener |
MediationRewardedVideoAdListener :
Listener to adapter with callbacks for various events. |
serverParameters |
Bundle :
Additional parameters defined by the publisher on the mediation server
side. |
networkExtras |
Bundle :
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.
|
Returns true
if the ad network has been initialized.
Returns | |
---|---|
boolean |
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 |
MediationAdRequest :
Generic parameters for this publisher to use when making his ad
request. |
serverParameters |
Bundle :
Additional parameters defined by the publisher on the mediation server
side. |
networkExtras |
Bundle :
Additional parameters set by the publisher on a per-request basis.
|
Shows the rewarded video ad. This can be called any time after a call to onAdLoaded(MediationRewardedVideoAdAdapter)