admob 问题总结二
来源:互联网 发布:java连接数据库步骤 编辑:程序博客网 时间:2024/06/05 11:29
下载了“GoogleAdMobAdsSDK-4.0.2.jar”,最新版的admob sdk 发现,最新版有如下变更。包括com.admob.android.ads.AdManager;android:name="com.google.ads.AdActivity"变更。
以下是摘自google code
AdMob Publisher Discuss
Hmm yes, you are right:
http://code.google.com/mobile/ads/kb/#whyupgrade
Coming from use of admob-sdk-android_20101109.zip, I now had to
replace
import com.admob.android.ads.AdManager;
import com.admob.android.ads.AdView;
by
import com.google.ads.*;
In the manifest I had to replace
android:name="com.admob.android.ads.AdMobActivity"
by
android:name="com.google.ads.AdActivity"
I had to replace instances of
adView = new AdView(this);
by
adView = new AdView(this, AdSize.BANNER, <ADMOB_PUBLISHER_ID>);
while from the manifest dropping the line
<meta-data android:value=<ADMOB_PUBLISHER_ID>
android:name="ADMOB_PUBLISHER_ID" />
I had to remove use of setPrimaryTextColor() and
setSecondaryTextColor(), but could keep setBackgroundColor().
I had to add new code like AdRequest adRequest = new AdRequest();
adView.loadAd(adRequest);
However, I cannot seem to find a good replacement for
AdManager.setTestDevices() to always exclude showing real ads on my
test phones without a need to recompile for a release version? I want
to make adRequest.setTesting(true) dependent on the phone that it is
running on. Using getDeviceId() and hard-coding my own IMEI numbers
does not seem proper. What is the proper way to handle this?
Interestingly, if I look at the LogCat output with the new SDK and
filtering for the LOGTAG "Ads" tag, I still see the exact same unique
test device identifiers, say <my_test_device_ID>, of my phones that I
used in the older SDK with AdManager.setTestDevices(), but now
appearing in LogCat lines like
INFO/Ads(28609): Received ad url: <"url": "http://r.admob.com:80/
ad_source.php?preqs=1& ... &isu=<my_test_device_ID>
So how do I now programmatically read this "isu" number to apply
adRequest.setTesting(true) only to my own devices? If this is no
longer possible then I would consider this an oversight in the new
SDK.
Thanks!
On Mar 20, 8:14 pm, Neil <neilb...@gmail.com> wrote:
- admob 问题总结二
- admob 问题总结二
- ADMOB的打包问题
- AdMob常见的问题
- admob 接入问题
- Admob广告相关问题分析
- admob升级问题整理汇集
- admob
- admob
- 背包问题总结二
- 日常问题总结 二
- admob在ios平台cpu使用率问题
- Eclipse开发android问题 - admob广告
- 疑问问题总结(二)
- 经典问题总结(二)
- ws问题总结(二)
- 集成 admob Banner广告出错之二 _OBJC_CLASS_$_EKEvent
- 关于新的AdMob升级的相关问题
- 最短路各种算法 稠密图 稀疏图 时间分析
- X87指令
- Hibernate在tomcat5.0.28下配数据源
- Example: Receive HTTP Post without web form via ASP.Net
- 分析android动画模块
- admob 问题总结二
- 什么是STL(Standard Template Library,标准模板库)
- 验证码的使用
- ZOJ 3336 Friend Number II
- wordpress 批量插入图片到文章
- XML 初步学习
- POJ 2253 Frogger 题后教训
- 无虚拟不是云?云计算到底是什么
- PL/SQL和InstantClient工具包连接oracle