How to set up 3rd-party ad networks (eg. Vungle) using Mopub mediation?

278 Views Asked by At

I have integrated Mopub in my app for Banner and Interstitial ads. The Mopub Marketplace ads are showing in the app, but I want to add a few 3rd-party networks as well. I am not sure how to integrate them correctly. I am trying to follow the integration guides, but the instructions on the Mopub website are different from the network websites.

For example, for Vungle ads: the Mopub guide has the following instructions:

To download the Vungle adapters, navigate to the Mediation Integration Tool. You will also need to download the Vungle SDK, which can be found below.

For the latest download and integration instructions, ensure that you have consulted Vungle’s tutorials before you integrate the SDK and adapters.

The Mediation Integration Tool provided the following code to add to my app:

// Add the following repositories 
maven { url 'https://jitpack.io' }

// Vungle
implementation 'com.vungle:publisher-sdk-android:6.4.11'
implementation 'com.mopub.mediation:vungle:6.4.11.2'

Doesn't this code include the Vungle adapters AND the Vungle SDK in my app? Or do I have to download the SDK manually and add it?

The guide on the Vungle website for integrating with Mopub also has these instructions:

Add all the Vungle-related adapter files to the /src/main/java/com/mopub/mobileads/ directory in your app’s project. This step is necessary because the MoPub SDK references these files as Custom Event Class properties in the directory.

VungleAdapterConfiguration.java

VungleBanner.java

VungleInterstitial.java

VungleNetworkSettings.java

VungleRewardedVideo.java

VungleRouter.java

VungleRouterListener.java

Do I also need to add these adapter files to my project, having already added the adapter provided by the Mopub Mediation Integration Tool?

1

There are 1 best solutions below

0
S. Gissel On

These are the needed dependencies for both MoPub itself and Vungle + Adapter.

//MOPUB
implementation('com.mopub:mopub-sdk:5.10.0@aar') {
    transitive = true
}
// Vungle
implementation 'com.vungle:publisher-sdk-android:6.5.1'
implementation ('com.github.Vungle.mopub-android-mediation:vungle:6.5.1.0-RC4@aar')

Then you can easily init MoPub SDK with Vungle from first start.

Map<String, String> vungleSettings = new HashMap<>();
    vungleSettings.put("appId", "VUNGLEAPPID");

SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder("MOPUB_ANY_BANNER_INTERSTITIAL...ID")             
        .withMediatedNetworkConfiguration(VungleAdapterConfiguration.class.getName(), vungleSettings)
        .withLogLevel(BuildConfig.DEBUG ? MoPubLog.LogLevel.DEBUG : MoPubLog.LogLevel.NONE)
        .build();

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