diff --git a/AdvancedExample/app/build.gradle b/AdvancedExample/app/build.gradle index e0dcc70f..24374351 100644 --- a/AdvancedExample/app/build.gradle +++ b/AdvancedExample/app/build.gradle @@ -38,7 +38,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.mediarouter:mediarouter:1.6.0' + implementation 'androidx.mediarouter:mediarouter:1.7.0' implementation 'com.android.support.constraint:constraint-layout:2.0.4' - implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.31.0' + implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.33.0' } diff --git a/AdvancedExample/build.gradle b/AdvancedExample/build.gradle index f0e99bbd..cb3f9812 100644 --- a/AdvancedExample/build.gradle +++ b/AdvancedExample/build.gradle @@ -6,6 +6,6 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.1.2' + classpath 'com.android.tools.build:gradle:8.3.2' } } diff --git a/AdvancedExample/gradle/wrapper/gradle-wrapper.properties b/AdvancedExample/gradle/wrapper/gradle-wrapper.properties index e6e6b174..ee26ec73 100644 --- a/AdvancedExample/gradle/wrapper/gradle-wrapper.properties +++ b/AdvancedExample/gradle/wrapper/gradle-wrapper.properties @@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip diff --git a/ExoPlayerExample/app/build.gradle b/ExoPlayerExample/app/build.gradle index a02eb358..3a2c949d 100644 --- a/ExoPlayerExample/app/build.gradle +++ b/ExoPlayerExample/app/build.gradle @@ -32,7 +32,7 @@ repositories { } dependencies { - def media3_version = "1.1.1" + def media3_version = "1.3.1" implementation "androidx.media3:media3-ui:$media3_version" implementation "androidx.media3:media3-exoplayer:$media3_version" diff --git a/ExoPlayerExample/app/src/main/java/com/google/ads/interactivemedia/v3/samples/exoplayerexample/MyActivity.java b/ExoPlayerExample/app/src/main/java/com/google/ads/interactivemedia/v3/samples/exoplayerexample/MyActivity.java index 092fc268..d092684c 100644 --- a/ExoPlayerExample/app/src/main/java/com/google/ads/interactivemedia/v3/samples/exoplayerexample/MyActivity.java +++ b/ExoPlayerExample/app/src/main/java/com/google/ads/interactivemedia/v3/samples/exoplayerexample/MyActivity.java @@ -1,5 +1,8 @@ package com.google.ads.interactivemedia.v3.samples.exoplayerexample; +import static android.os.Build.VERSION.SDK_INT; + +import android.annotation.SuppressLint; import android.app.Activity; import android.net.Uri; import android.os.Bundle; @@ -7,7 +10,6 @@ import android.util.Log; import android.widget.TextView; import androidx.media3.common.MediaItem; -import androidx.media3.common.util.Util; import androidx.media3.datasource.DataSource; import androidx.media3.datasource.DefaultDataSource; import androidx.media3.exoplayer.ExoPlayer; @@ -19,6 +21,8 @@ import com.google.ads.interactivemedia.v3.api.AdEvent; /** Main Activity. */ +@SuppressLint("UnsafeOptInUsageError") +/* @SuppressLint is needed for new media3 APIs. */ public class MyActivity extends Activity { private static final String SAMPLE_VIDEO_URL = @@ -72,7 +76,7 @@ public AdEvent.AdEventListener buildAdEventListener() { @Override public void onStart() { super.onStart(); - if (Util.SDK_INT > 23) { + if (SDK_INT > 23) { initializePlayer(); if (playerView != null) { playerView.onResume(); @@ -83,7 +87,7 @@ public void onStart() { @Override public void onResume() { super.onResume(); - if (Util.SDK_INT <= 23 || player == null) { + if (SDK_INT <= 23 || player == null) { initializePlayer(); if (playerView != null) { playerView.onResume(); @@ -94,7 +98,7 @@ public void onResume() { @Override public void onPause() { super.onPause(); - if (Util.SDK_INT <= 23) { + if (SDK_INT <= 23) { if (playerView != null) { playerView.onPause(); } @@ -105,7 +109,7 @@ public void onPause() { @Override public void onStop() { super.onStop(); - if (Util.SDK_INT > 23) { + if (SDK_INT > 23) { if (playerView != null) { playerView.onPause(); } diff --git a/ExoPlayerExample/build.gradle b/ExoPlayerExample/build.gradle index e41eeaf4..72e8e2f4 100644 --- a/ExoPlayerExample/build.gradle +++ b/ExoPlayerExample/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.1.2' + classpath 'com.android.tools.build:gradle:8.3.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/ExoPlayerExample/gradle/wrapper/gradle-wrapper.properties b/ExoPlayerExample/gradle/wrapper/gradle-wrapper.properties index 3fd4644d..663758d9 100644 --- a/ExoPlayerExample/gradle/wrapper/gradle-wrapper.properties +++ b/ExoPlayerExample/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip diff --git a/audioplayerexample/app/build.gradle b/audioplayerexample/app/build.gradle index fbc176db..bd3287b0 100644 --- a/audioplayerexample/app/build.gradle +++ b/audioplayerexample/app/build.gradle @@ -22,7 +22,7 @@ android { } defaultConfig { applicationId "com.google.ads.interactivemedia.v3.samples.audioplayerexample" - minSdkVersion 21 + minSdkVersion 29 targetSdkVersion 34 versionCode 1 versionName "1.0" @@ -43,12 +43,12 @@ repositories { dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")) implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.media:media:1.6.0' - def media3_version = "1.1.1" + implementation 'androidx.media:media:1.7.0' + def media3_version = "1.3.1" implementation "androidx.media3:media3-ui:$media3_version" implementation "androidx.media3:media3-exoplayer:$media3_version" implementation "androidx.media3:media3-session:$media3_version" implementation 'com.google.guava:guava:28.1-android' - implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.31.0' + implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.33.0' } diff --git a/audioplayerexample/app/src/main/AndroidManifest.xml b/audioplayerexample/app/src/main/AndroidManifest.xml index 8af5ada7..9c9f80e7 100644 --- a/audioplayerexample/app/src/main/AndroidManifest.xml +++ b/audioplayerexample/app/src/main/AndroidManifest.xml @@ -20,6 +20,7 @@ + @@ -38,6 +39,7 @@ + android:exported="false" + android:foregroundServiceType="mediaPlayback"/> diff --git a/audioplayerexample/app/src/main/java/com/google/ads/interactivemedia/v3/samples/audioplayerexample/AudioPlayerService.java b/audioplayerexample/app/src/main/java/com/google/ads/interactivemedia/v3/samples/audioplayerexample/AudioPlayerService.java index 6ef71892..18c7bbb9 100644 --- a/audioplayerexample/app/src/main/java/com/google/ads/interactivemedia/v3/samples/audioplayerexample/AudioPlayerService.java +++ b/audioplayerexample/app/src/main/java/com/google/ads/interactivemedia/v3/samples/audioplayerexample/AudioPlayerService.java @@ -3,11 +3,13 @@ import static com.google.ads.interactivemedia.v3.samples.audioplayerexample.Constants.PLAYBACK_CHANNEL_ID; import static com.google.ads.interactivemedia.v3.samples.audioplayerexample.Constants.PLAYBACK_NOTIFICATION_ID; +import android.annotation.SuppressLint; import android.app.Notification; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; +import android.content.pm.ServiceInfo; import android.graphics.Bitmap; import android.os.Binder; import android.os.IBinder; @@ -37,18 +39,20 @@ * Allows audio playback with hooks for advertisements. This is meant to run as a Foreground Service * to enable playback to continue even if the app is minimized or cleaned up. */ +@SuppressLint("UnsafeOptInUsageError") +/* @SuppressLint is needed for new media3 APIs. */ public class AudioPlayerService extends Service { private boolean isAdPlaying; private ExoPlayer player; - private PlayerNotificationManager playerNotificationManager; private MediaSession mediaSession; - private ImaService imaService; + private PlayerNotificationManager playerNotificationManager; private ConcatenatingMediaSource contentMediaSource; + private ImaService imaService; + private final Samples.Sample[] sampleList = Samples.getSamples(); @Override - @androidx.media3.common.util.UnstableApi public void onCreate() { super.onCreate(); final Context context = this; @@ -127,7 +131,10 @@ public void onNotificationStarted( int notificationId, Notification notification, boolean ongoing) { // This must be called within 5 seconds of the notification being displayed and // before the main app has been killed. - startForeground(notificationId, notification); + startForeground( + notificationId, + notification, + ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK); } @Override @@ -176,7 +183,6 @@ public void claim() { player.setPlayWhenReady(false); } - @androidx.media3.common.util.UnstableApi public void release() { if (isAdPlaying) { isAdPlaying = false; @@ -187,7 +193,6 @@ public void release() { } } - @androidx.media3.common.util.UnstableApi public void prepare(MediaSource mediaSource) { player.setMediaSource(mediaSource); player.prepare(); diff --git a/audioplayerexample/build.gradle b/audioplayerexample/build.gradle index f0e99bbd..cb3f9812 100644 --- a/audioplayerexample/build.gradle +++ b/audioplayerexample/build.gradle @@ -6,6 +6,6 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.1.2' + classpath 'com.android.tools.build:gradle:8.3.2' } } diff --git a/audioplayerexample/gradle/wrapper/gradle-wrapper.properties b/audioplayerexample/gradle/wrapper/gradle-wrapper.properties index 33c7a396..06388faa 100644 --- a/audioplayerexample/gradle/wrapper/gradle-wrapper.properties +++ b/audioplayerexample/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip diff --git a/basicexample/app/build.gradle b/basicexample/app/build.gradle index 01976283..574febff 100644 --- a/basicexample/app/build.gradle +++ b/basicexample/app/build.gradle @@ -34,7 +34,7 @@ repositories { dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")) implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.browser:browser:1.6.0' - implementation 'androidx.media:media:1.6.0' - implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.31.0' + implementation 'androidx.browser:browser:1.8.0' + implementation 'androidx.media:media:1.7.0' + implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.33.0' } diff --git a/basicexample/build.gradle b/basicexample/build.gradle index e41eeaf4..72e8e2f4 100644 --- a/basicexample/build.gradle +++ b/basicexample/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.1.2' + classpath 'com.android.tools.build:gradle:8.3.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/basicexample/gradle/wrapper/gradle-wrapper.properties b/basicexample/gradle/wrapper/gradle-wrapper.properties index 3fd4644d..663758d9 100644 --- a/basicexample/gradle/wrapper/gradle-wrapper.properties +++ b/basicexample/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip diff --git a/umpexample/app/build.gradle b/umpexample/app/build.gradle index 860659c5..105386de 100644 --- a/umpexample/app/build.gradle +++ b/umpexample/app/build.gradle @@ -34,8 +34,8 @@ repositories { dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")) implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.browser:browser:1.6.0' - implementation 'androidx.media:media:1.6.0' - implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.31.0' - implementation 'com.google.android.ump:user-messaging-platform:2.1.0' + implementation 'androidx.browser:browser:1.8.0' + implementation 'androidx.media:media:1.7.0' + implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.33.0' + implementation 'com.google.android.ump:user-messaging-platform:2.2.0' } diff --git a/umpexample/build.gradle b/umpexample/build.gradle index e41eeaf4..72e8e2f4 100644 --- a/umpexample/build.gradle +++ b/umpexample/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.1.2' + classpath 'com.android.tools.build:gradle:8.3.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/umpexample/gradle/wrapper/gradle-wrapper.properties b/umpexample/gradle/wrapper/gradle-wrapper.properties index 3fd4644d..663758d9 100644 --- a/umpexample/gradle/wrapper/gradle-wrapper.properties +++ b/umpexample/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip