This page will store any utilities that can used in conjuntion with the Prebid SDK.
Prebid SDK provides a function findPrebidCreativeSize
to address a bug in the Google Ad Manager ad server (described here) where under certain situations ads fail to render.
It is recommended all Google Ad Manager integrations resize all ads served based on the winning Prebid creative size findPrebidCreativeSize
. Functionally speaking the Prebid SDK resizes ad slots based on the onAdLoaded (when an ad is received) to determine the winning Prehbid ad size to determine how to resize the ad slot.
findPrebidCreativeSize
is supported on Android API versions 19+. Using on earlier versions is safe to use, however the resizing would not function.Usage example:
adView.adListener = object : AdListener() {
override fun onAdLoaded() {
super.onAdLoaded()
// Determine the kind of winning line item
AdViewUtils.findPrebidCreativeSize(adView, object : AdViewUtils.PbFindSizeListener {
override fun success(width: Int, height: Int) {
// In the case of Prebid's line item - resize te ad view
adView.setAdSizes(AdSize(width, height))
}
override fun failure(error: PbFindSizeError) {}
})
}
}