cocos2dx2.2.3按照官方文档加入Admod.启动应用在eclipse日志显示“Ad finished loading”,但是界面中不显示广告,
只有通过锁屏后重新点亮屏幕时能够显示。
经过Google解决方案如下
1 adView.loadAd(adRequest); 2 adView.setBackgroundColor(Color.BLACK); 3 addContentView(adView,adParams); 4 adView.setBackgroundColor(0);
另外在大陆测试admob需要VPN,否则也有可能不显示广告。
参考网址:
http://discuss.cocos2d-x.org/t/cocos2dxglsurfaceview-hide-my-addview-withusing-admob-for-android-device/11458/6
http://stackoverflow.com/questions/22277904/adview-not-appear-in-android-cocos2dx
摘抄:
Hello everyone.
I‘ll try to display admob on Android Device.
Curiously, When I run my game. First Time, I can‘t see addView screen.
But Lock and UnLock, If I come back my game. Then I can see addView without any problem.
I‘m searching many code snip.
But I don‘t find correct answoer.
This just my own isseu? Kindly can you check my source code.
Why,First Time, I can‘t see admob screen.
Hello.
I found solution. This is not JNI issue.
Simpley, This is come from admob with using google play service.
For solving this issue, I just add below lineadView.loadAd(adRequest);
adView.setBackgroundColor(Color.BLACK);
addContentView(adView, adParams);Then without any problem, From application starting, I can see admob view.
Thanks.If you need further infomation can you refer below
http://stackoverflow.com/questions/17975659/how-to-duplicate-sprite-of-sprites-in-cocos2d-x-2-1-44
cocos2dx加Admob不显示的解决方法