AdMob:在android应用中嵌入广告的方案
2010-06-03 16:04:00 来源:WEB开发网AdMob:在android应用中嵌入广告的方案 - [手机开发]
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://cjbskysea.blogbus.com/logs/64953528.html
AdMob 是一个比较成熟的移动平台广告商,其为android和iphone提供了非常方便的集成 JAR包,使得开发者可以在自己的应用中很方便的嵌入其提供的广告,进而按照广告展示和点击次数付广告费。
例子:如何在自己的应用中集成AdMob的广告功能
去http://www.admob.com/注册一个帐号,然后添加一个“Add Mobile Site”,输入相关信息后,提交完成,进入AD代码获取界面,其提供了PHP,Rails等等类型的代码,同时提供了Android平台使用的JAR,这里就演示这个。
1、下载JAR包
其为android平台提供了JAR包,然后将JAR添加到你的项目组,按照如下步骤
*
Go to the Properties of your project (right-click on your project from the Package Explorer tab and select Properties)
*
Select "Java Build Path" from left panel
*
Select "Libraries" tab from the main window
*
Click on "Add JARs..."
*
Select the JAR copied to the libs directory
*
Click "OK" to add the SDK to your android project
2、编辑AndroidManifest.xml
Your AdMob publisher ID was given to you when creating your publisher account on www.admob.com before downloading this code. It is a 15-character code like a14a48e3387c5ce. Just before the closing < /application > tag add a line to set your publisher ID:
< !-- The application's publisher ID assigned by AdMob -- >
< meta-data android:value="YOUR_ID_HERE" android:name="ADMOB_PUBLISHER_ID" / >
< /application >
Set any permissions not already included just before the closing < /manifest > tag:
< !-- AdMob SDK permissions -- >
< uses-permission android:name="android.permission.INTERNET" / >
更多精彩
赞助商链接