androidandroid-4.0-ice-cream-sandwichmillennial-media

White rectangular area in Millennial Media banner on Android 4.0


In my game I have both Millennial Media and Admob banners implemented (Millennial on top of the screen, Admob on the bottom). Everything is done programatically in Android/Java with the use of RelativeLayout, firstly I'm adding MMAdView then OpenGl surface and at the end AdmobView. On the devices with Android < 4.0 everything is drawn correctly but on Ice Cream Sandwich there is a huge white area instead the Millennial banner. I've been struggling with this problem for far too long. Any ideas what can be wrong there?
UPDATE: My friend told me that this white rectangular area is visible when he's not connected to Wifi network. In my code I'm not making any checks of the network availability. I simply trigger millennialView.setVisibility(View.VISIBLE) method to display the banner.

    adMobView = new AdView(this, AdSize.BANNER, ADMOB_BANNER_ID);
    adMobView.setAdListener(getAdMobListener());
    AdRequest request = new AdRequest();
    adMobView.loadAd(request);

    RelativeLayout.LayoutParams lay = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    lay.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);        
    layout.addView(adMobView, lay);

// ... adding OpenGL surface

    int bannerWidth = (int)(displayMetrics.widthPixels * displayMetrics.density);

    Hashtable<String, String> map = new Hashtable<String, String>();
    map.put(MMAdView.KEY_WIDTH, String.valueOf(bannerWidth));
    map.put(MMAdView.KEY_HEIGHT, "53");
    millennialView = new MMAdView(this, MILLENNIAL_BANNER_ID, MMAdView.BANNER_AD_TOP, 30, map);
    millennialView.setId(MMAdViewSDK.DEFAULT_VIEWID);
    millennialView.setListener(getMillennialListener());

Solution

  • It seems that the problem was Millennial banner being displayed when network was unavailable. Now, before presenting the banner I simply check if there is a network connection:

        ConnectivityManager connectivityMgr =
            (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
        if(connectivityMgr != null && connectivityMgr.getActiveNetworkInfo() != null) {
                millennialView.setVisibility(View.VISIBLE);