Closed sjvc closed 4 months ago
@sjvc
Thank you for the well formatted feature request. I think this is a reasonable request, and have filed for this internally (b/326123984).
I will close this issue for now, feel free to reopen if you have something more to add.
Environment:
Issue description:
There appears to be a significant discrepancy in the Google Mobile Ads Unity plugin compared to its Android counterpart, particularly in determining the height of anchored adaptive banners. In Unity, the
AdSize.GetCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(width)
method returns anAdSize
object with a height of 0, unlike the expected behavior observed in the Android SDK.Steps to reproduce:
AdSize.GetCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(width)
in a Unity project.AdSize
object contains a height value of 0, indicating an inability to pre-determine the banner height.Expected vs. Actual Behavior
In the AdMob Android native SDK, the method
AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(activity, screenWidth)
provides the exact ad size, including its height, before creation. This is crucial for optimizing layout and user experience. The expected behavior is for the Unity plugin to provide a similar capability, ensuring consistency across platforms.Relevant Code Snippet from Android SDK:
Upon examining the functionality of the Android native method
AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(activity, screenWidth)
, it internally invokes a method designed to calculate the adaptive ad size as follows:I understand the documentation and previous discussions have highlighted that the anchored banner height is capped at the lesser of 15% of the device's height or 90 density-independent pixels (with a minimum of 50 density-independent pixels), but the internal method used by AdMob Android native SDK suggests a more precise approach that also takes screen width into account.
Request for Enhancement
Given the importance of cross-platform consistency and the need for precise ad layout planning, could the Unity plugin be enhanced to align with the Android SDK's functionality? Implementing a method that provides the actual size of an anchored adaptive banner, including its height, before its creation would be a significant improvement. This feature would not only ensure consistency but also greatly enhance the flexibility and usability of the SDK for Unity developers.