File tree Expand file tree Collapse file tree 4 files changed +10
-0
lines changed
admanager/BannerExample/app/src/main/java/com/google/android/gms/example/bannerexample
admob/BannerExample/app/src/main/java/com/google/android/gms/example/bannerexample
admanager/BannerExample/app/src/main/kotlin/com/google/android/gms/example/bannerexample
admob/BannerExample/app/src/main/java/com/google/android/gms/example/bannerexample Expand file tree Collapse file tree 4 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,7 @@ private void initializeMobileAdsSdk() {
204204 .start ();
205205 }
206206
207+ // [START get_ad_size]
207208 // Get the ad size with screen width.
208209 public AdSize getAdSize () {
209210 DisplayMetrics displayMetrics = getResources ().getDisplayMetrics ();
@@ -218,4 +219,5 @@ public AdSize getAdSize() {
218219 int adWidth = (int ) (adWidthPixels / density );
219220 return AdSize .getCurrentOrientationAnchoredAdaptiveBannerAdSize (this , adWidth );
220221 }
222+ // [END get_ad_size]
221223}
Original file line number Diff line number Diff line change @@ -213,6 +213,7 @@ private void initializeMobileAdsSdk() {
213213
214214 // [END request_ads]
215215
216+ // [START get_ad_size]
216217 // Get the ad size with screen width.
217218 public AdSize getAdSize () {
218219 DisplayMetrics displayMetrics = getResources ().getDisplayMetrics ();
@@ -227,4 +228,5 @@ public AdSize getAdSize() {
227228 int adWidth = (int ) (adWidthPixels / density );
228229 return AdSize .getCurrentOrientationAnchoredAdaptiveBannerAdSize (this , adWidth );
229230 }
231+ // [END get_ad_size]
230232}
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ class MyActivity : AppCompatActivity() {
4545 private lateinit var binding: ActivityMyBinding
4646 private lateinit var googleMobileAdsConsentManager: GoogleMobileAdsConsentManager
4747
48+ // [START get_ad_size]
4849 // Get the ad size with screen width.
4950 private val adSize: AdSize
5051 get() {
@@ -61,6 +62,8 @@ class MyActivity : AppCompatActivity() {
6162 return AdSize .getCurrentOrientationAnchoredAdaptiveBannerAdSize(this , adWidth)
6263 }
6364
65+ // [END get_ad_size]
66+
6467 override fun onCreate (savedInstanceState : Bundle ? ) {
6568 super .onCreate(savedInstanceState)
6669 binding = ActivityMyBinding .inflate(layoutInflater)
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ class MainActivity : AppCompatActivity() {
4545 private lateinit var binding: ActivityMainBinding
4646 private lateinit var googleMobileAdsConsentManager: GoogleMobileAdsConsentManager
4747
48+ // [START get_ad_size]
4849 // Get the ad size with screen width.
4950 private val adSize: AdSize
5051 get() {
@@ -61,6 +62,8 @@ class MainActivity : AppCompatActivity() {
6162 return AdSize .getCurrentOrientationAnchoredAdaptiveBannerAdSize(this , adWidth)
6263 }
6364
65+ // [END get_ad_size]
66+
6467 override fun onCreate (savedInstanceState : Bundle ? ) {
6568 super .onCreate(savedInstanceState)
6669 binding = ActivityMainBinding .inflate(layoutInflater)
You can’t perform that action at this time.
0 commit comments