setting adUnitId in runtime

414 views
Skip to first unread message

Vlad

unread,
Oct 10, 2011, 2:19:02 PM10/10/11
to Google AdMob Ads Developers
Hi there, anyone knows how to set adUnitId for AdView in runtime?

Thank you.

metin ögtem

unread,
Oct 10, 2011, 2:24:57 PM10/10/11
to google-adm...@googlegroups.com
it depends which admob-sdk you use ??

2011/10/10, Vlad <vkro...@gmail.com>:

Eric Leichtenschlag

unread,
Oct 10, 2011, 2:55:54 PM10/10/11
to google-adm...@googlegroups.com
What is the use case for setting adUnitId during runtime?  Why wouldn't you want it to be static?

Eric, AdMob SDK Support

Vlad

unread,
Oct 10, 2011, 2:56:13 PM10/10/11
to Google AdMob Ads Developers
I am using latest sdk 4.1.1.

On Oct 10, 11:24 am, metin ögtem <android.develope...@gmail.com>
wrote:
> it depends which admob-sdk you use ??
>
> 2011/10/10, Vlad <vkrou...@gmail.com>:

Vlad

unread,
Oct 10, 2011, 3:00:25 PM10/10/11
to Google AdMob Ads Developers
Use case is very simple. I have a service which provisions application
with configuration settings. One of them is adUnitId which is
controlled centrally on the service and is not statically compiled in
on device. I am looking for Android support.

Please advise as putting it in strings.xml is still static compiling.

On Oct 10, 11:55 am, Eric Leichtenschlag <eleichtens...@google.com>
wrote:

Jim

unread,
Oct 10, 2011, 3:03:38 PM10/10/11
to Google AdMob Ads Developers
Eric,

When filters work, I would like to be able to have user input
determine ad selection, for which some settings are adUnitId specific
(e.g. if a user indicates "male" then not only would I like to have
the AdRequest indicate "male" but I want the ad filters to be
different).

Does that help?

-Jim

On Oct 10, 1:55 pm, Eric Leichtenschlag <eleichtens...@google.com>
wrote:

Eric Leichtenschlag

unread,
Oct 10, 2011, 5:19:17 PM10/10/11
to google-adm...@googlegroups.com
Jim,

If I understand you correctly, it wouldn't really be an SDK feature, but maybe an AdMob front-end feature that would allow you to configure your filters based on some input.  For example, you may want AdMob to turn off gambling ads if you give the AdRequest a gender of female.  That seems a lot more intuitive and powerful than having the overhead of specifying and maintaining multiple publisher ids with different filters.

Vlad,

You can create your AdView programmatically, and give it whatever adUnitId you want at runtime.  The only limitation is that you have to specify the adUnitId when you create the AdView (i.e. there is no "setAdUnitId" method).  If you wanted to change id's, you'll have to create a new AdView.

Cheers,
Eric, AdMob SDK Support



 

Jim

unread,
Oct 10, 2011, 5:27:54 PM10/10/11
to Google AdMob Ads Developers
Eric,

You are absolutely right. Can I have it by Friday?

Just kidding about Friday, but having filters and features that
enhance ad relevancy are the most effective means by which we can
improve user experience - and revenue.

Thanks for suggesting the alternative. Please add it to the
'enhancement request' list.

-Jim

On Oct 10, 4:19 pm, Eric Leichtenschlag <eleichtens...@google.com>
wrote:

Vlad

unread,
Oct 10, 2011, 7:46:29 PM10/10/11
to Google AdMob Ads Developers
Eric,

Thank you. I know I can create AdView on the fly. The issue is that my
AdView is part of my layouts already, its nice to have it that way. Is
there a way to change AdView unit id in already defined layout? It
seems to me an easy feature to implement?

Thank you, Vlad.

On Oct 10, 2:19 pm, Eric Leichtenschlag <eleichtens...@google.com>
wrote:
Reply all
Reply to author
Forward
0 new messages