CustomEventRewardedAd

public abstract class CustomEventRewardedAd

A base class for custom events that support rewarded ads. Implementing a subclass of CustomEventRewardedAd() enables the MoPub SDK to support rewarded ad mediation with other ad networks.

Public Methods

public protected abstract boolean /checkAndInitializeSdk(Activity launcherActivity, Map<String,Object> localExtras, Map<String,String> serverExtras)

  • Description: Initializes the network SDK. Returns true if if the SDK performed initialization; false if the SDK was already initialized.

  • Parameters:

    • launcherActivity: The “main activity” of the app. Useful for initializing SDKs.
    • localExtras: A map containing additional custom data a publisher can set by calling MoPubView.setLocalExtras() from the app.
    • serverExtras: A map containing server-side data that a publisher entered for a particular ad network in the MoPub UI. This data may contain dynamic information, such as ad unit IDs, that can be used to make ad requests to the network.

public protected abstract String /getAdNetworkId()

  • Description: Returns the ID string for this ad unit with the ad network (the “ad unit id”, “zone id,” or similar identifier for the network). May be empty if the network does not have anything more specific than an application ID.

  • Parameters: None.

public protected abstract LifecycleListener /getLifecycleListener()

  • Description: Notifies the network SDK of the custom event’s activity lifecycle events. This is optional and only required for networks that rely on these events. Returns a LifecycleListener. May be null.

  • Parameters: None.

public protected abstract boolean /isReady()

  • Description: Implementers should query the third-party SDK for whether the third-party SDK & ID represented by the custom event is ready to be shown. Returns true if a video is available to play; false otherwise.

  • Parameters: None.

public protected abstract void /loadWithSdkInitialized(Activity activity, Map<String,Object> localExtras, Map<String,String> serverExtras)

  • Description: Issues an ad request to the network SDK, provided that it has been initialized.

  • Parameters:

    • activity: The “main activity” of the app. Useful for initializing SDKs.
    • localExtras: A map containing additional custom data a publisher can set by calling MoPubView.setLocalExtras() from the app.
    • serverExtras: A map containing server-side data that a publisher entered for a particular ad network in the MoPub UI. This data may contain dynamic information, such as ad unit IDs, that can be used to make ad requests to the network.

public protected abstract void /onInvalidate()

  • Description: Destroys the current rewarded ad object and unregisters any hanging references.

  • Parameters: None.

public protected abstract void /show()

  • Description: Implementers should now play the rewarded item for this custom event.

  • Parameters: None.

Last updated February 11, 2020

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2020 MoPub (a division of Twitter, Inc.)