Setup advertising with Google IMA
Since IMA is a third-party SDK and not shipped as part of the Bitmovin Player, you must first add the necessary dependencies to the project's build.gradle.kts
or build.gradle
file.
Additionally it is important, to use the +jason
build flavor of the Bitmovin Player, as both the Bitmovin Player and the IMA SDK rely on different variants of the media3-common
module.
In order to use the IMA SDK, starting with version 3.37.0
, you need to enable coreLibraryDesugaring
. (See also the Set up the IMA SDK Guide from Google)
android {
compileOptions {
isCoreLibraryDesugaringEnabled = true
}
}
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
implementation("com.google.ads.interactivemedia.v3:interactivemedia:3.37.0")
implementation("com.bitmovin.player:player:{version-number}+jason")
}
android {
compileOptions {
setCoreLibraryDesugaringEnabled(true)
}
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.37.0'
implementation 'com.bitmovin.player:player:{version-number}+jason'
}
Further add your Ad Manager app ID (identified in the Ad Manager UI) to your app's AndroidManifest.xml
file. To do so, add a <meta-data>
tag with android:name="com.google.android.gms.ads.APPLICATION_ID"
.
See also the Quick Start Guide from Google.
<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true" />
</application>
</manifest>
Where to go from here?
By adding the dependencies the IMA integration is enabled in the Bitmovin Android Player and can be used with the AdSourceType.Ima
. You can follow Setting up Ads with the Android SDK to schedule and play back your first ad.
Updated 22 days ago