Domanda

I integrate Admob to my Android Cocos2dx project. But it not show when I start app. It onlys show when I open new Activity and back to it. That problem only when I use new Admob (in Google Play Service), not happen with old Admob SDK.

This is my code in onCreate():

adView = new AdView(mContext);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("MyAdId");

AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("MyDeviceId")
.build();

adView.loadAd(adRequest);

LayoutParams adParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
addContentView(adView, adParams);
È stato utile?

Soluzione

http://www.cocos2d-x.org/forums/6/topics/45240

Same problem as yours and the solution is strange:

adView.loadAd(adRequest);
adView.setBackgroundColor(Color.BLACK);
addContentView(adView,adParams);
adView.setBackgroundColor(0);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top