Full-width AdMob native ads for Android using Google Mobile Ads SDK for Unity

1,248 views
Skip to first unread message

BT

unread,
Jun 15, 2017, 11:05:32 AM6/15/17
to Google Mobile Ads SDK Developers
I am trying to create a native ad like this:

nativeExpressAdView = new NativeExpressAdView(adUnitId, new AdSize(360, 150), AdPosition.Bottom);  

Instead of hardcoding the screen width as 360, I would like to use the full-width available on the device. Smart banners work great for banner ads, but passing AdSize.SmartBanner as second argument does not work here.

Screen.width returns actual pixels. 

Is there a way to obtain the width in dp that I can pass onto the AdSize constructor?

Deepika Uragayala- MobileAds SDK team

unread,
Jun 15, 2017, 4:00:00 PM6/15/17
to Google Mobile Ads SDK Developers
Hi there,

The AdSize has to be manually set and the ideal way would be to determine the screen width before you make the AdRequest. Currently, the Mobile Ads plugin does not provide a method to do so automatically. You can use this method if it helps.

Regards,
Deepika Uragayala
Mobile Ads SDK Team

Ennesoft

unread,
Jul 1, 2017, 11:37:06 AM7/1/17
to Google Mobile Ads SDK Developers
Hi Deepika,
and for App developed by Android Studio is the same?

Many thx in advance.

Joshua Lagonera (Mobile Ads SDK Team)

unread,
Jul 3, 2017, 2:12:09 AM7/3/17
to Google Mobile Ads SDK Developers
Hi there,

For Android applications developed in Android Studio, you can use FULL_WIDTH as the width of the Ad, as shown below:

ads:adSize="FULL_WIDTHx50"
 
You can view our official documentation for additional information regarding Choosing your Native Express Ad Size.

Regards,
Joshua Lagonera
Mobile Ads SDK Team 
Message has been deleted

JM Chilgren

unread,
Sep 13, 2017, 10:54:08 AM9/13/17
to Google Mobile Ads SDK Developers
Does ads:adSize="FULLWIDTHx50" work with the new consolidated Native+Standard AdView? (Meaning, can the FULLWIDTH size now be used with standard banner ads, in addition to native?) Trying to get an ad unit size 600x100 to stretch full width.
Message has been deleted

Deepika Uragayala- MobileAds SDK team

unread,
Sep 13, 2017, 3:37:09 PM9/13/17
to Google Mobile Ads SDK Developers
Hi JM,

For Banner AdView, FULL_WIDTH is not supported and here are the list of valid AdSizes for Banner AdView.

Let us know if you have any other questions. I'll be happy to help.

Regards,
Deepika Uragayala
Mobile Ads SDK Team


Reply all
Reply to author
Forward
0 new messages