Add an ad client dependency (Android)

Enable Google IMA and Google DAI ad requests in your Android app


📘

If you are not using Google IMA or Google DAI to serve your ads, skip to Schedule VAST ads.


The JWX Android SDK integrates the Google IMA and Google DAI SDKs that you can request ads.

Google IMA ads allow you to integrate multimedia ads into your websites and apps1. Google Dynamic Ad Insertion (DAI) allows you to serve video ads into live linear programming and video on demand content2.

1. Source: Interactive Media Ads SDKs
2. Source: Learn about Dynamic Ad Insertion (DAI)



Prerequisites

Google IMA

Item Description
Embedded JWX player JWX player with content
Ad tag (IMA, VAST) URL of the ad tag for VAST and IMA plugins.

📘

The ad tag must be an active tag generated from an advertising platform in a supported ad format.


Google DAI

Item Description
Embedded JWX player JWX player with content
Ad tag (IMA, VAST) URL of the ad tag for VAST and IMA plugins.

📘

The ad tag must be an active tag generated from an advertising platform in a supported ad format.

Google Ad Manager 360 Server-side DAI backend used by the IMA SDK for ad decisioning, stream stitching, and tracking for live and on-demand content


Add Google IMA client dependencies

Gradle

Follow these steps to add the dependencies:

  1. In the build.gradle file of your app, add com.jwplayer:jwplayer-ima:$jwPlayerVersion. Be sure to define the dependency version number ($jwPlayerVersion).

    dependencies {
      ...
      implementation 'com.jwplayer:jwplayer-core:$jwPlayerVersion'
      implementation 'com.jwplayer:jwplayer-common:$jwPlayerVersion'
      implementation 'com.jwplayer:jwplayer-ima:$jwPlayerVersion'
      implementation 'com.google.ads.interactivemedia.v3:interactivemedia:$googleImaVersion'
      implementation 'com.google.android.gms:play-services-ads-identifier:$googleImaVersion'
    }
    
  2. Enable desugaring.

    📘

    Core library desugaring enables newer Java standard library APIs to be used on older Android versions by rewriting them at build time.

    dependencies {
      coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5' // Use the latest version recommended by the Android Gradle Plugin.
    }
    
    android {
      defaultConfig {
        multiDexEnabled true // Optional. This may be required depending on app method count.
      }
    
      compileOptions {
        coreLibraryDesugaringEnabled true
      }
    }
    
  3. When prompted, click Sync Now to apply the Gradle changes.


Local

Follow these steps to add the dependencies:

  1. With your app open in Android Studio, click File > New > New Module... > Import .JAR / .AAR Package.
  2. Click Next.
  3. Select the jwplayer-ima-x.x.aar file from your computer.

    💡

    If you do not have a jwplayer-ima-x.x.x.aar file on your computer, you can download the Android SDK .zip from your JWX dashboard.

  4. Click Finish.
  5. Click File > Project Structure... > Dependencies. Under Modules, be sure that your app is selected.
  6. Click the plus sign in the main panel.
  7. Select Module dependency.
  8. Select the checkbox next to the name of each dependency that needs to be added.
  9. Click OK.
  10. Click Apply.
  11. Click OK.

Enable desugaring

Follow these steps to enable desugaring:

  1. In the app build.gradle file of your app, enable desugaring.

    📘

    Core library desugaring enables newer Java standard library APIs to be used on older Android versions by rewriting them at build time.

    dependencies {
      coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5' // Use the latest version recommended by the Android Gradle Plugin.
    }
    
    android {
      defaultConfig {
        multiDexEnabled true // Optional. This may be required depending on app method count.
      }
    
      compileOptions {
        coreLibraryDesugaringEnabled true
      }
    }
    
  2. When prompted, click Sync Now to apply the Gradle changes.



Add Google DAI client dependencies

Gradle

Follow these steps to add the dependencies:

  1. In the app build.gradle file of your app, add com.jwplayer:jwplayer-ima:$jwPlayerVersion. Be sure to define the dependency version number ($jwPlayerVersion).

    dependencies {
      ...
      implementation 'com.jwplayer:jwplayer-core:$jwPlayerVersion'
      implementation 'com.jwplayer:jwplayer-common:$jwPlayerVersion'
      implementation 'com.jwplayer:jwplayer-ima:$jwPlayerVersion'
      implementation 'com.google.ads.interactivemedia.v3:interactivemedia:$googleImaVersion'
      implementation 'com.google.android.gms:play-services-ads-identifier:$googleImaVersion'
    }
    
  2. When prompted, click Sync Now to apply the Gradle changes.


Local

Follow these steps to add the dependencies:

  1. With your app open in Android Studio, click File > New > New Module... > Import .JAR / .AAR Package.
  2. Click Next.
  3. Select the jwplayer-ima-x.x.aar file from your computer.

    💡

    If you do not have a jwplayer-ima-x.x.x.aar file on your computer, you can download the Android SDK .zip from your JWX dashboard.

  4. Click Finish.
  5. Click File > Project Structure... > Dependencies. Under Modules, be sure that your app is selected.
  6. Click the plus sign in the main panel.
  7. Select Module dependency.
  8. Select the checkbox next to the name of each dependency that needs to be added.
  9. Click OK.
  10. Click Apply.
  11. Click OK.


© 2007- Longtail Ad Solutions, Inc.