AppOpenAd bug with targetSdkVersion 36 in landscape mode?

11 views
Skip to first unread message

netl...@gmail.com

unread,
9:04 AM (5 hours ago) 9:04 AM
to Google Mobile Ads SDK Developers
Hi, I'm trying to update my app to targetSdkVersion 36, but this seems to break many things, including AdMob ads - I am noticing the AppOpenAd gets cut out when displayed in landscape mode on the emulator running Android 16, but if I change it back to  targetSdkVersion 34, it is no longer cut out and displays properly. Attached screenshot how it looks like on Android 16 with targetSdkVersion 36.

Also, I noticed that the code for adaptive banners seems to be wrong and doesn't take in account if there is a navigation bar in the right of the screen in landscape mode, so the banner will be cut out/too large: https://developers.google.com/admob/android/banner/inline-adaptive

Shouldn't the code actually be like this?
int adWidth;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
WindowInsets windowInsets = activity.getWindow().getDecorView().getRootWindowInsets();
Insets insets = windowInsets.getInsets(WindowInsets.Type.systemBars() | WindowInsets.Type.displayCutout());
Rect rect = activity.getWindowManager().getCurrentWindowMetrics().getBounds();
adWidth = rect.width() - insets.left - insets.right;
} else {
adWidth = Resources.getSystem().getDisplayMetrics().widthPixels;
}
float density = Resources.getSystem().getDisplayMetrics().density;
adWidth = (int) (adWidth / density);
adView.setAdSize(AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(activity, adWidth));

What are we supposed to do? We can no longer release any updates if we don't target Android 16, but if we do, it breaks AdMob ads.

Thanks
AppOpenAd bug.png
Reply all
Reply to author
Forward
0 new messages