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());
Caleb
  • 124,013
  • 19
  • 183
  • 272
Eric
  • 1,685
  • 1
  • 17
  • 32
  • 1
    A screenshot would help tremendously... – Codo Jul 03 '12 at 11:49
  • I have only an information from my friend, who's got 4.0 on board. There is a white rectangular area (1/3 of the screen) on top of the screen. He's not having Wifi enabled and when he tap it the game crashes unexpectedly. – Eric Jul 03 '12 at 16:48

1 Answers1

0

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);
Eric
  • 1,685
  • 1
  • 17
  • 32