Skip to content

Commit

Permalink
Updates samples to v3.35.1.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 686922796
  • Loading branch information
google-ima-devrel-bot authored and IMA Developer Relations committed Oct 17, 2024
1 parent 0f84edf commit 6e832e5
Show file tree
Hide file tree
Showing 15 changed files with 107 additions and 95 deletions.
2 changes: 1 addition & 1 deletion AdvancedExample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.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.35.0'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.35.1'
}
2 changes: 1 addition & 1 deletion AdvancedExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath 'com.android.tools.build:gradle:8.7.0'
}
}
6 changes: 5 additions & 1 deletion AdvancedExample/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
android.enableJetifier=true
android.useAndroidX=true
android.useAndroidX=true

# Prevents the GitHub actions build from failing with a
# "java.lang.OutOfMemoryError: Java heap space" error.
org.gradle.jvmargs=-Xms1024m -Xmx4096m
2 changes: 1 addition & 1 deletion ExoPlayerExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath 'com.android.tools.build:gradle:8.7.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion ExoPlayerExample/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
4 changes: 2 additions & 2 deletions audioplayerexample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ dependencies {
implementation "androidx.media3:media3-exoplayer:$media3_version"
implementation "androidx.media3:media3-session:$media3_version"

implementation 'com.google.guava:guava:32.1.3-android'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.35.0'
implementation 'com.google.guava:guava:33.0.0-android'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.35.1'
}
2 changes: 1 addition & 1 deletion audioplayerexample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath 'com.android.tools.build:gradle:8.7.0'
}
}
4 changes: 4 additions & 0 deletions audioplayerexample/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
android.enableJetifier=true
android.useAndroidX=true

# Prevents the GitHub actions build from failing with a
# "java.lang.OutOfMemoryError: Java heap space" error.
org.gradle.jvmargs=-Xms1024m -Xmx4096m
2 changes: 1 addition & 1 deletion basicexample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.browser:browser:1.8.0'
implementation 'androidx.media:media:1.7.0'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.35.0'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.35.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.google.ads.interactivemedia.v3.api.AdEvent;
import com.google.ads.interactivemedia.v3.api.AdsLoader;
import com.google.ads.interactivemedia.v3.api.AdsManager;
import com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent;
import com.google.ads.interactivemedia.v3.api.AdsRenderingSettings;
import com.google.ads.interactivemedia.v3.api.AdsRequest;
import com.google.ads.interactivemedia.v3.api.ImaSdkFactory;
Expand Down Expand Up @@ -95,88 +94,85 @@ public void onAdError(AdErrorEvent adErrorEvent) {
}
});
adsLoader.addAdsLoadedListener(
new AdsLoader.AdsLoadedListener() {
@Override
public void onAdsManagerLoaded(AdsManagerLoadedEvent adsManagerLoadedEvent) {
// Ads were successfully loaded, so get the AdsManager instance. AdsManager has
// events for ad playback and errors.
adsManager = adsManagerLoadedEvent.getAdsManager();

// Attach event and error event listeners.
adsManager.addAdErrorListener(
new AdErrorEvent.AdErrorListener() {
/** An event raised when there is an error loading or playing ads. */
@Override
public void onAdError(AdErrorEvent adErrorEvent) {
Log.e(LOGTAG, "Ad Error: " + adErrorEvent.getError().getMessage());
String universalAdIds =
Arrays.toString(adsManager.getCurrentAd().getUniversalAdIds());
Log.i(
LOGTAG,
"Discarding the current ad break with universal "
+ "ad Ids: "
+ universalAdIds);
adsManager.discardAdBreak();
adsManagerLoadedEvent -> {
// Ads were successfully loaded, so get the AdsManager instance. AdsManager has
// events for ad playback and errors.
adsManager = adsManagerLoadedEvent.getAdsManager();

// Attach event and error event listeners.
adsManager.addAdErrorListener(
new AdErrorEvent.AdErrorListener() {
/** An event raised when there is an error loading or playing ads. */
@Override
public void onAdError(AdErrorEvent adErrorEvent) {
Log.e(LOGTAG, "Ad Error: " + adErrorEvent.getError().getMessage());
String universalAdIds =
Arrays.toString(adsManager.getCurrentAd().getUniversalAdIds());
Log.i(
LOGTAG,
"Discarding the current ad break with universal "
+ "ad Ids: "
+ universalAdIds);
adsManager.discardAdBreak();
}
});
adsManager.addAdEventListener(
new AdEvent.AdEventListener() {
/** Responds to AdEvents. */
@Override
public void onAdEvent(AdEvent adEvent) {
if (adEvent.getType() != AdEvent.AdEventType.AD_PROGRESS) {
Log.i(LOGTAG, "Event: " + adEvent.getType());
}
});
adsManager.addAdEventListener(
new AdEvent.AdEventListener() {
/** Responds to AdEvents. */
@Override
public void onAdEvent(AdEvent adEvent) {
if (adEvent.getType() != AdEvent.AdEventType.AD_PROGRESS) {
Log.i(LOGTAG, "Event: " + adEvent.getType());
}
// These are the suggested event types to handle. For full list of
// all ad event types, see AdEvent.AdEventType documentation.
switch (adEvent.getType()) {
case LOADED:
// AdEventType.LOADED is fired when ads are ready to play.

// This sample app uses the sample tag
// single_preroll_skippable_ad_tag_url that requires calling
// AdsManager.start() to start ad playback.
// If you use a different ad tag URL that returns a VMAP or
// an ad rules playlist, the adsManager.init() function will
// trigger ad playback automatically and the IMA SDK will
// ignore the adsManager.start().
// It is safe to always call adsManager.start() in the
// LOADED event.
adsManager.start();
break;
case CONTENT_PAUSE_REQUESTED:
// AdEventType.CONTENT_PAUSE_REQUESTED is fired when you
// should pause your content and start playing an ad.
pauseContentForAds();
break;
case CONTENT_RESUME_REQUESTED:
// AdEventType.CONTENT_RESUME_REQUESTED is fired when the ad
// you should play your content.
resumeContent();
break;
case ALL_ADS_COMPLETED:
// Calling adsManager.destroy() triggers the function
// VideoAdPlayer.release().
adsManager.destroy();
adsManager = null;
break;
case CLICKED:
// When the user clicks on the Learn More button, the IMA SDK fires
// this event, pauses the ad, and opens the ad's click-through URL.
// When the user returns to the app, the IMA SDK calls the
// VideoAdPlayer.playAd() function automatically.
break;
default:
break;
}
// These are the suggested event types to handle. For full list of
// all ad event types, see AdEvent.AdEventType documentation.
switch (adEvent.getType()) {
case LOADED:
// AdEventType.LOADED is fired when ads are ready to play.

// This sample app uses the sample tag
// single_preroll_skippable_ad_tag_url that requires calling
// AdsManager.start() to start ad playback.
// If you use a different ad tag URL that returns a VMAP or
// an ad rules playlist, the adsManager.init() function will
// trigger ad playback automatically and the IMA SDK will
// ignore the adsManager.start().
// It is safe to always call adsManager.start() in the
// LOADED event.
adsManager.start();
break;
case CONTENT_PAUSE_REQUESTED:
// AdEventType.CONTENT_PAUSE_REQUESTED is fired when you
// should pause your content and start playing an ad.
pauseContentForAds();
break;
case CONTENT_RESUME_REQUESTED:
// AdEventType.CONTENT_RESUME_REQUESTED is fired when the ad
// you should play your content.
resumeContent();
break;
case ALL_ADS_COMPLETED:
// Calling adsManager.destroy() triggers the function
// VideoAdPlayer.release().
adsManager.destroy();
adsManager = null;
break;
case CLICKED:
// When the user clicks on the Learn More button, the IMA SDK fires
// this event, pauses the ad, and opens the ad's click-through URL.
// When the user returns to the app, the IMA SDK calls the
// VideoAdPlayer.playAd() function automatically.
break;
default:
break;
}
});
AdsRenderingSettings adsRenderingSettings =
ImaSdkFactory.getInstance().createAdsRenderingSettings();
// Add any ads rendering settings here.
// This init() only loads the UI rendering settings locally.
adsManager.init(adsRenderingSettings);
}
}
});
AdsRenderingSettings adsRenderingSettings =
ImaSdkFactory.getInstance().createAdsRenderingSettings();
// Add any ads rendering settings here.
// This init() only loads the UI rendering settings locally.
adsManager.init(adsRenderingSettings);
});

// When the play button is clicked, request ads and hide the button.
Expand Down
2 changes: 1 addition & 1 deletion basicexample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath 'com.android.tools.build:gradle:8.7.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
6 changes: 5 additions & 1 deletion basicexample/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
android.enableJetifier=true
android.useAndroidX=true
android.useAndroidX=true

# Prevents the GitHub actions build from failing with a
# "java.lang.OutOfMemoryError: Java heap space" error.
org.gradle.jvmargs=-Xms1024m -Xmx4096m
2 changes: 1 addition & 1 deletion umpexample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.browser:browser:1.8.0'
implementation 'androidx.media:media:1.7.0'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.35.0'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.35.1'
implementation 'com.google.android.ump:user-messaging-platform:3.0.0'
}
2 changes: 1 addition & 1 deletion umpexample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath 'com.android.tools.build:gradle:8.7.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
6 changes: 5 additions & 1 deletion umpexample/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
android.enableJetifier=true
android.useAndroidX=true
android.useAndroidX=true

# Prevents the GitHub actions build from failing with a
# "java.lang.OutOfMemoryError: Java heap space" error.
org.gradle.jvmargs=-Xms1024m -Xmx4096m

0 comments on commit 6e832e5

Please sign in to comment.