To test this feature and view the example code, please see the Android SDK 5 Example Code Quick Start guide.

This application inserts advertisements using the IMAWrapper class via the Google Interactive Media Ads (IMA) SDK to access ad servers that support VAST and VMAP. For more information, see the Google IMA SDK for Android Get started and IMA sample tags pages.


Advert server already configured and knowledge of the ad tag URLs that will be used to access it.

Example code

The Java source code contains the IMAWrapper package that simplifies configuration and access to an ad-server, as well as playback and display of the adverts. The following instructions show you how to modify your existing application to make use of the IMAWrapper package with the Google IMA libraries; the main stages are:

Project setup

In the application project you are building, update your Gradle script to fetch the Google IMA Play Services libraries from the Google Maven repository.

Add the repository.

    repositories {

    ... << other repositories omitted >> ...

      maven {
        url ""

Add the following third-party dependencies.

 ... <<details omitted >> ...

    dependencies {
      ... << other dependencies omitted >> ...

      implementation ''
      implementation ''

To resolve conflicts in child dependencies, you will need a file.


Next step: Enable playback of linear adverts.