Adwhirl + Millenial Media ads size - too long

973 Views Asked by At

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

1

There are 1 best solutions below

7
On

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.