1

The white rectangular area (which cover whole screen when MMedia banner is displayed) exists on devices with Android 4.0+ while using only the pure Java code. Adding lines which specify width and height doesn't fix a thing (white screen still persists). Hope the issue will get investigated by Millennial team. Cheers

MMSDK.initialize(this);

millennialView = new MMAdView(this);
millennialView.setApid(MILLENNIAL_BANNER_ID);
millennialView.setId(MMSDK.getDefaultAdId());

RelativeLayout.LayoutParams lay2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
lay2.addRule(RelativeLayout.ALIGN_PARENT_TOP);
layout.addView(millennialView, lay2);

Map<String, String> metaData = new HashMap<String, String>();
metaData.put("width", "480");
metaData.put("height", "60");

MMRequest mmediaRequest = new MMRequest();
mmediaRequest.setMetaValues(metaData);
millennialView.setMMRequest(mmediaRequest);
millennialView.setListener(getMillennialListener());

millennialView.getAd(); 
Eric
  • 1,685
  • 1
  • 17
  • 32

3 Answers3

0

This is related to the MMAdView's size when it's applied to a layout hierarchy. The MMAdView doesn't recognize WRAP_CONTENT due to internal changes in its WebView. As such, Millennial's documentation asks that you explicitly set the ad size. See step two here: http://docs.millennialmedia.com/android-SDK/AndroidBannerAds.html

An interesting side-effect: if you're using a mediation partner (AdMob or MoPub, for instance), the same must be done for their banner view widgets (AdView and MoPubView, respectively).

  • I've ended up putting all the MMedia related code to the xml file and wrapping it with android:layout_width="480dp" android:layout_height="60dp". And as a side note as it is really hard to get any response from you in the normal way (via email). It seems that somehow you clear all the cache associated with an application. The last time I've updated MMedia to v5.0 and added Interstitals to my game it wiped out several game's progress data from users phones. Somebody should get a chair for that, really – Eric Apr 23 '13 at 15:37
0

I've ended up putting all the MMedia related code to the xml file and wrapping it with android:layout_width="480dp" android:layout_height="60dp"

Eric
  • 1,685
  • 1
  • 17
  • 32
  • Hi, I am facing the same problem. Can you share your XML file? It would be helpful. – Vamsi Challa May 20 '13 at 15:34
  • If you can help, here is my question, please have a look at it - http://stackoverflow.com/questions/16653670/integrate-millennial-media-sdk-5-0-in-android-application – Vamsi Challa May 20 '13 at 16:16
0

Same problem in latest MMedia APi 5.2.

I use a list view to attach the Adview. Using match content for the height.

After some testing I found that the banner ad only takes the whole screen in Android 4.04 on the devices that I have. 4.4 and Gingerbread seem to be ok.

Here is my code to get around the problem:

float density = getResources().getDisplayMetrics().density;
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) {
    height = display.getHeight();
    width = display.getWidth();
} else {
    Point size = new Point();
    display.getSize(size);
    height = size.y;
    width = size.x;
}

LinearLayout layout = (LinearLayout)findViewById(R.id.llBannerAd);
if (width/density > 727 && height/density > 600) {
        mAdView.setAdSize(AdSize.LEADERBOARD);
        layout.setLayoutParams(new LinearLayout.LayoutParams(width, 91));
} else if (width/density > 467 && height/density > 400) {
    mAdView.setAdSize(AdSize.FULL_BANNER);
    layout.setLayoutParams(new LinearLayout.LayoutParams(width,61));
} else {
        mAdView.setAdSize(AdSize.BANNER);
    layout.setLayoutParams(new LinearLayout.LayoutParams(width, 55));
}
AchimD
  • 26
  • 1
  • 6