|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.ads.mediation.customevent.CustomEventAdapter
public class CustomEventAdapter
An adapter for custom events.
This implements the logic for creating a custom event object and calling its
requestInterstitialAd
or requestBannerAd
method. It also contains the logic for
passing events back from the publisher custom event listener to the mediation framework. The
custom event class name is passed as a server parameter. This adapter does not use an
extra-parameters object and so the first generic parameter is Void.
Note that unlike "first-class" ad networks, multiple custom events in the same mediation placement would all share the same adapter class.
Constructor Summary | |
---|---|
CustomEventAdapter()
|
Method Summary | |
---|---|
void |
destroy()
Tears down the adapter control. |
Class<EmptyNetworkExtras> |
getAdditionalParametersType()
Returns the class that provides additional parameters to this adapter. |
View |
getBannerView()
Returns a View that can be rendered to display the ad. |
Class<CustomEventServerParameters> |
getServerParametersType()
Returns the class that provides parameters set by the mediation backend to this adapter. |
void |
requestBannerAd(MediationBannerListener mediationListener,
Activity activity,
CustomEventServerParameters serverParameters,
AdSize adSize,
MediationAdRequest mediationAdRequest,
EmptyNetworkExtras mediationExtras)
Called by the mediation library to request an ad from the adapter. |
void |
requestInterstitialAd(MediationInterstitialListener mediationListener,
Activity activity,
CustomEventServerParameters serverParameters,
MediationAdRequest mediationAdRequest,
EmptyNetworkExtras mediationExtras)
Called by the mediation library to request an ad from the adapter. |
void |
showInterstitial()
Shows the interstitial. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CustomEventAdapter()
Method Detail |
---|
public void requestBannerAd(MediationBannerListener mediationListener, Activity activity, CustomEventServerParameters serverParameters, AdSize adSize, MediationAdRequest mediationAdRequest, EmptyNetworkExtras mediationExtras)
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<EmptyNetworkExtras,CustomEventServerParameters>
mediationListener
- 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 MediationAdapterListener.onFailedToReceiveAd should be called.mediationAdRequest
- Generic parameters for this publisher to use when making his ad
requestmediationExtras
- Additional parameters set by the publisher on a per-request basispublic View getBannerView()
MediationBannerAdapter
View
that can be rendered to display the ad.
This must not be null after a MediationBannerAdapter.requestBannerAd(com.google.ads.mediation.MediationBannerListener, android.app.Activity, SERVER_PARAMETERS, com.google.ads.AdSize, com.google.ads.mediation.MediationAdRequest, ADDITIONAL_PARAMETERS)
call and before a
MediationAdapter.destroy()
call. It may be null any other time.
getBannerView
in interface MediationBannerAdapter<EmptyNetworkExtras,CustomEventServerParameters>
public void showInterstitial()
MediationInterstitialAdapter
MediationInterstitialListener.onReceivedAd(com.google.ads.mediation.MediationInterstitialAdapter, ?>)
.
showInterstitial
in interface MediationInterstitialAdapter<EmptyNetworkExtras,CustomEventServerParameters>
public void requestInterstitialAd(MediationInterstitialListener mediationListener, Activity activity, CustomEventServerParameters serverParameters, MediationAdRequest mediationAdRequest, EmptyNetworkExtras mediationExtras)
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<EmptyNetworkExtras,CustomEventServerParameters>
mediationListener
- 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
requestmediationExtras
- Additional parameters set by the publisher on a per-request basispublic Class<EmptyNetworkExtras> getAdditionalParametersType()
MediationAdapter
getAdditionalParametersType
in interface MediationAdapter<EmptyNetworkExtras,CustomEventServerParameters>
public Class<CustomEventServerParameters> getServerParametersType()
MediationAdapter
getServerParametersType
in interface MediationAdapter<EmptyNetworkExtras,CustomEventServerParameters>
public void destroy()
MediationAdapter
This is called at the end of the mediator's life cycle. The adapter is expected to release
any resources and shut down. After this method is called, any subsequent calls to any other
method on this adapter may throw an IllegalStateException
.
This method is not guaranteed to be called. There are a number of reasons that this method can be skipped, such as a force close of the application.
destroy
in interface MediationAdapter<EmptyNetworkExtras,CustomEventServerParameters>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |