File tree Expand file tree Collapse file tree
java/NextGenExample/app/src/main/java/com/example/snippets
kotlin/NextGenExample/app/src/main/java/com/example/snippets Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- // Copyright 2025 Google LLC
1+ // Copyright 2026 Google LLC
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -128,5 +128,15 @@ public void onAdPaid(AdValue value) {
128128 private boolean isAdAvailable (String adUnitId ) {
129129 return InterstitialAdPreloader .isAdAvailable (adUnitId );
130130 }
131+
131132 // [END isAdAvailable]
133+
134+ // [START stop_preload]
135+ private void stopPreloading (String adUnitId ) {
136+ // Stops the preloading and destroys preloaded ads.
137+ InterstitialAdPreloader .destroy (adUnitId );
138+ // Stops the preloading and destroys all ads.
139+ InterstitialAdPreloader .destroyAll ();
140+ }
141+ // [END stop_preload]
132142}
Original file line number Diff line number Diff line change 1- // Copyright 2025 Google LLC
1+ // Copyright 2026 Google LLC
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -116,6 +116,16 @@ private class InterstitialAdSnippets {
116116
117117 // [END isAdAvailable]
118118
119+ // [START stop_preload]
120+ private fun stopPreloading (adUnitId : String ) {
121+ // Stops the preloading and destroys preloaded ads.
122+ InterstitialAdPreloader .destroy(adUnitId)
123+ // Stops the preloading and destroys all ads.
124+ InterstitialAdPreloader .destroyAll()
125+ }
126+
127+ // [END stop_preload]
128+
119129 private companion object {
120130 const val TAG = " InterstitialAdSnippets"
121131 }
You can’t perform that action at this time.
0 commit comments