一、注册admob账号。
二、将自己的app添加到站点管理。
三、下载SDK。
四、获取publisher ID。
五、admob显示设置。
六、在*.java中添加控制代码。
七、常见问题解释。
一、注册admob账号。
注册的网址是:http://zhcn.admob.com/。怎么注册就不说了,这点基本的英语总该会的。
二、将自己的app添加到站点管理。
登陆账号,点击“站点和应用程序”--“添加网站/应用程序”,进入添加页面。按照说明添加设置。
见下图。
三、下载SDK。和获取publisher ID。
设置好之后,“应用程序设置”--“发布者ID”(复制ID)--“获取发布者代码”,进入下载SDK页面。
见下图。
四、admob显示设置。
分别设置“广告样式”,“自动刷新”,“测试模式”。关键是设置测试模式。
见下图。
五、在*.java中添加控制代码。
要改的有2个地方,1.配合文件许可--
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
2.在*.java添加广告请求代码。
主要使用SDK帮助文档,和google官方的网站。
http://code.google.com/intl/zh-CN/mobile/ads/docs/android/intermediate.html。
七、常见问题解释。
1.添加了广告无法显示。服务器满载,无法响应广告请求。
官方的原文如下:
think I've implemented everything correctly, so why am I not seeing ads?
While maintaining the highest possible fill rate is one of our top priorities, we may not always have an ad available for every ad request. This can be especially common during development, when ad requests are typically made infrequently from a small number of users and devices. When apps are newly registered on AdMob it may also take some time and several requests before impressions are consistently delivered. Developers generally see more consistent results once they have released their app and ad requests arrive more frequently from a more diverse user base.
Try making your ad requests in test mode to verify your implementation. As test mode operates through the same channels as live ads, successfully returning a test ad should verify your code.
Note: that the very first time AdMob sees your publisher ID it may take up to two minutes to receive an ad, and this initial two minute lag will recur every time the app goes unused for 24 hours.
解决的方法,在开发的时候,设置为测试模式。即添加: request.setTesting(true);