码迷,mamicode.com
首页 > 其他好文 > 详细

cocos2dx加Admob不显示的解决方法

时间:2014-07-22 22:42:15      阅读:359      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   color   os   

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 line

adView.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不显示的解决方法,布布扣,bubuko.com

cocos2dx加Admob不显示的解决方法

标签:android   style   blog   http   color   os   

原文地址:http://www.cnblogs.com/codingdiary/p/3860185.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!