3

I have some problem with ads showing in Adwhirl.

I'm showing Millenial Media and Admob ads there.

Admob is looking pretty good but when MM ad is loaded it looks that the ad is too long.

I was trying to fix it in some ways but couldn't repair it.

Here is my Java code for Adwhirl:

LinearLayout layout = (LinearLayout) findViewById(R.id.layout_main);

AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "apid");
RelativeLayout.LayoutParams adWhirlLayoutParams = 
                 new RelativeLayout.LayoutParams(
                        LayoutParams.FILL_PARENT,
                        LayoutParams.WRAP_CONTENT);
int diWidth = 320;
int diHeight = 53;

float density = getResources().getDisplayMetrics().density;

adWhirlLayout.setMaxWidth((int)(diWidth * density + 0.5f));
adWhirlLayout.setMaxHeight((int)(diHeight * density + 0.5f));

layout.addView(adWhirlLayout, adWhirlLayoutParams);
layout.invalidate();

If someone know how to fix it please help.

EDIT:

I'm working on HTC Desire and also tried to create adwhirl layout in xml and still same issue ;(

I tried to add MM Layout to xml and with parameter app:width="320" it looks good. Default it is 480 and with this value the ad looks similar to adwhirl implementaion (too long)

xmlns:app="http://millennialmedia.com/android/schema"

<com.millennialmedia.android.MMAdView
android:id="@+id/mmadview" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"
app:apid="28911"
app:adType="MMBannerAdTop"
app:refreshInterval="30"
app:accelerate="true"
app:ignoreDensityScaling="false"
app:age="46"
app:gender="female"
app:zip="90210"
app:income="85000"
app:keywords="moms,shopping,groceries"
app:ethnicity="hispanic"
app:orientation="straight"
app:marital="married"
app:children="2"
app:education="college"
app:politics="libertarian"
app:height="60"
app:width="480" /> <------------------------------------HERE 

Maybe there is some possibility to set this value in adwhirl layout?

EDIT 2:

It looks that there is problem with 480x800 devices resolution. I debuged app on QVGA 320x240 emulator and ad looks pretty nice.

EDIT 3:

It looks like on image in link: Too long MM ad in Adwhirl Layout

When ad appears i can see horizontal scrollbar and i think that I can see only 2/3 of these ads

ByQ
  • 31
  • 2
  • I'm not using AdWhirl but I have the same problem, the ads are too big... Have you found a solution or contacted Millennial Media about it? – rfgamaral Jan 21 '12 at 18:11

1 Answers1

0

I wonder if an issue with trying to calculate width and height. Try this basic snippet instead:

LinearLayout layout = (LinearLayout) findViewById(R.id.layout_main);
AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "apid");
layout.addView(adWhirlLayout);

UPDATE:

You can also create an AdWhirlLayout via XML.

<com.adwhirl.AdWhirlLayout
    android:id="@+id/adwhirl_layout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>

AdWhirl gets your SDK key by looking in the manifest for this snippet:

<meta-data android:value="YOUR_SDK_KEY"
    android:name="ADWHIRL_KEY" />

UPDATE 2:

So according to the Millennial documentation, it is recommended that you don't set the height or width, but let the SDK optimize based on the device. The HTC Desire has a 1.5 screen density, so the 320x53 ad should get scaled up to something like 480x79.5. This explains why 480 is the default. I'm still not sure why it is too long. It should fit perfectly. When you say too long, is it too long by just a few pixels, or is it too long by a factor of 1.5?

UPDATE 3:

So I was actually able to reproduce the issue, and this looks like a bug on Millennial's end. I'm not sure if it's just the creative because I was only able to get that exact ad, but that ad is definitely 480dp wide when it should only be 480px wide. If you put your device in landscape mode you can see how big it is.

I would suggest contacting Millennial and asking them if they have seen this issue before.

Eric Leichtenschlag
  • 8,881
  • 1
  • 28
  • 28
  • I was trying this solution but still have same issue. Also when tried to put adwhirl layout with width=fill_parent and height=wrap_content in xml have same problem. For tests i added MM ad layout in xml and when i set app:width="320" then it was good but in adwhirl i'm not able to set this parameter ;/ – ByQ Jan 13 '12 at 12:26
  • Weird, I wonder if you are testing on some large device or something. I think Millennial tries to return the largest size ad that will fit, but I'm not sure how it does this. Anyways, you can define an AdWhirlLayout in XML too, I'll edit my answer to show you how. Maybe from there you can try setting the width on it. – Eric Leichtenschlag Jan 13 '12 at 18:23
  • I added some more info in first post – ByQ Jan 13 '12 at 19:47
  • Updated post with screen of ad – ByQ Jan 13 '12 at 21:52
  • Updated answer again. My best guess is it's a Millennial bug. – Eric Leichtenschlag Jan 17 '12 at 18:33
  • Anyone found solution to this problem? Nothing in adwhirl docs & millennial wiki – imort Jan 20 '12 at 07:11
  • @RicardoAmaral anyone? anyone? the tariff bill? did *anybody* on this here list solve this at all? – bharal Oct 15 '14 at 03:35