How to place variable sizes native advanced ads in a scrolling page

303 views
Skip to first unread message

Voolen Studios

unread,
May 22, 2018, 2:09:15 AM5/22/18
to Google Mobile Ads SDK Developers
Hi

Greetings. 

We would like to place variable sizes native advanced ads in a scrolling page. It is an image gallery with card view. when we tried to place multiple size ads, we couldn't success. It permits only same size ads in single page. We want to place one small native banner, one big native banner and one more card size native ad which will be same as that of other images in the card view in order. Would you help us to resolve this issue?

Thanking you

mobileadssdk-a...@google.com

unread,
May 22, 2018, 6:10:25 AM5/22/18
to google-adm...@googlegroups.com, teste...@gmail.com
Hi, 

Please note that unlike the regular Banner Ads, the Native Advanced Ads doesn't have any Ad sizes constants. This is because Native Advanced Ads are used to allow you to format the layout of the Native Ad and how it will be presented. Thus, it will be up to you how big the layout will be for each Native Ad.

That said, I created this modified NativeAdvancedExample app for your reference. This sample implementation is just for testing purposes to show how to display 3 Native Ads of different sizes in one ScrollView parent layout. 

Below are the changes made from the original NativeAdvancedExample app.
  • Created 3 different layouts for 3 Native Ads (ad_unified.xml, large_ad_unified.xml, med_ad_unified.xml). They are identical layouts, however, I just adjusted the height of each layout and put some labels to show the differences between the Native Ads with different sizes.
  • In the activity_main layout, I created 3 FrameLayout placeholders where the 3 Native Ads will be presented vertically once they're loaded.
  • Created 3 refresh functions (refreshSmallAd(), refreshMedAd(), refreshLargeAd()) for each Native Ad that will separately create the AdLoader for each Native Ad to be loaded.
Regards,
Ivan Bautista
Mobile Ads SDK Team
Reply all
Reply to author
Forward
0 new messages