MoPub SDK Initialization

The MoPub 5.0 SDK introduces a new API for initialization called MoPub.initializeSdk(). This API is required for a number of new functionalities, including GDPR consent mechanisms and rewarded video. If you have been using MoPubRewardedVideos.initializeRewardedVideo(), it is now part of the new initialization, so make sure to switch to the new API.


You only need to initialize once using any valid ad unit ID from your app. Ad requests should only be made once the SDK initialization has completed.

  1. In your Activity’s onCreate() (or equivalent), instantiate an SdkConfiguration via a Builder with any valid ad unit ID from your app, your mediation settings (optional), and/or a list of mediated rewarded video adapters (optional).
  2. Call MoPub.initializeSdk() and pass in a Context (recommended to be of an Activity type), the SdkConfiguration object, and an SdkInitializationListener object.


// A list of rewarded video adapters to initialize
List<String> networksToInit = new ArrayList<String>();

SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder("AD_UNIT_ID")

MoPub.initializeSdk(this, sdkConfiguration, initSdkListener());

private SdkInitializationListener initSdkListener() {
   return new SdkInitializationListener() {
       public void onInitializationFinished() {
           /* MoPub SDK initialized. 
           Check if you should show the consent dialog here, and make your ad requests. */

Last updated September 16, 2018

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.

© 2018 MoPub Inc.