Get Started with Vungle - Android SDK v.1.0 - v.4.1

This guide helps you easily integrate our SDK into your app so you can start monetizing! Vungle Android SDK version 4.1.0 supports Android Nougat (API 7.0) with multi-window mode capability and enhanced video ad experience. If you are upgrading our SDK from previous versions, please refer to the Upgrade Guide.


Before you Begin...
1. Download the SDK
2. Add Vungle SDK to your Project
3. Update AndroidManifest.xml 
4. Initialize and Integrate the SDK
5. Play an Ad! 

Before you Begin..


  • Android 3.0 (Honeycomb - API version 11) or later
  • If your application is written in C/C++, you'll need to use JNI to interface with the Publisher SDK written in Java
  • Java 1.7 - For Android 5.+ compatibility purposes, JDK 7 is required on the development system
  • Java 1.8 - For Android 7.+ compatibility purposes, JDK 8 is required on the development system 

Here are a few important tips:

  • If you haven't already done so, follow our step by step guide to add your app on the Vungle Dashboard. Once you've done this, be sure to take note of the App ID on your application page. We'll need to use this App ID to initialize the Vungle Android SDK later.

  • If you’d rather just jump right in with our sample app, see our sample folder in GitHub. Otherwise, read on! There are only five steps we'll need to follow.

1. Download the SDK

The Vungle Android SDK is available for download from the Vungle Dashboard. Extract the archive once it's finished downloading.

2. Add Vungle SDK To Your Project

Copy all of the libraries from the extracted /libs directory into your project's /libs directory. Create this directory if it doesn't already exist in your project. This should automatically add the libraries your project's gradle dependencies.

The Vungle Android SDK requires the following libraries:

  • dagger-[version].jar
  • javax.inject-[version].jar
  • rxjava-[version].jar
  • eventbus-[version].jar
  • vungle-publisher-[version].jar

If you already include the same versions of any of the above libraries, don't re-include them, because you may run into compilation errors.  Please test out both available versions of the dependency library to determine which version works best in your app. 

3. Update AndroidManifest.xml

Add the following lines to your AndroidManifest.xml:


<!-- permissions to download and cache video ads for playback -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- Required activities for playback of Vungle video Ads -->
 <activity android:name="com.vungle.publisher.VideoFullScreenAdActivity"

<activity android:name="com.vungle.publisher.MraidFullScreenAdActivity"




4. Initialize and Integrate the SDK

Application Startup

Initialize the Publisher SDK in your application's first Activity. This starts video pre-caching and prepares the SDK to display ads.

import com.vungle.publisher.VunglePub;

public class FirstActivity extends {

  // get the VunglePub instance
  final VunglePub vunglePub = VunglePub.getInstance();

  public void onCreate(Bundle savedInstanceState) {

      // get your App ID from the app's main page on the Vungle Dashboard after setting up your app
      final String app_id = "your Vungle App ID";

      // initialize the Publisher SDK
      vunglePub.init(this, app_id);

Each Activity

In addition, override the onPause and onResume methods in each Activity (including the first) to ensure that the Vungle Android SDK is properly updated when your application gains or loses focus :

import com.vungle.publisher.VunglePub;

public class EachActivity extends {

  // get the VunglePub instance
  final VunglePub vunglePub = VunglePub.getInstance();


  protected void onPause() {

  protected void onResume() {

5. Play an Ad

Default Configuration

Almost done! When you're ready to play an ad in your application, simply call the Vungle Android SDK's playAd method

import com.vungle.publisher.VunglePub;

public class GameActivity extends {

  // get the VunglePub instance
  final VunglePub vunglePub = VunglePub.getInstance();


  private void onLevelComplete() {

Tip 1 - Check out our Advanced Settings Guide to subscribe to play events. These can be used to unpause audio, resume gameplay, etc.

Tip 2 - If you'd like to check if an ad is available before playing, use:

// indicates if an ad is ready to play

NOTE: While your app is in Test mode, you will not be able to download any of the apps advertised. Additionally, the Dashboard will not report the number of impressions. This is because test ads are used only to verify that you have integrated the SDK correctly. This functionality becomes available once your app has gone live in active mode.

Google Play Services (Optional)

Including Google Play Services with your project will allow Vungle to provide a more customized ad experience to the end-user, but it's not required. We recommend using version 4.0.30 or higher.

To include Google Play Services, we recommend Google's setup guide. In your app, ensure that the device has a sufficiently up-to-date version of Google Play Services.

For more questions about Google Play Services, check out some of our Google Play Services Frequently Asked Questions.

For Android SDK version 3.3.5 or above:

If you use play-services 7.8.0:

  • include play-services-ads
  • include play-services-location
  • retain the support library

If you use play-services 8.4.0:

  • include play-services-ads
  • include play-services-location
  • the support library is NOT required

That's it, you're on the road to Monetization!

Advanced Settings

If you're interested in some of the more advanced details of the Vungle Android SDK (customization, event listeners, etc.), feel free to check out our Advanced Settings Guide.

Was this article helpful?
6 out of 7 found this helpful