ITeye博客

为免费app嵌入Admob广告

yinter · 2009-11-13 17:33 · android · 移动开发 · Markdown

为免费app嵌入Admob广告,进而获得广告收入。 1.http://www.admob.com/注册一个帐号,

添加Add Mobile Site/app,输入相关信息后,提交完成,

下载Android平台使用的JAR,查看发布者 ID。 2.然后将JAR添加到你的项目中

Properties->Java Build Path->Libraries->Add JARs…->Select the JAR->OK 3.编辑AndroidManifest.xml

application节点中添加

<!– The application’s publisher ID assigned by AdMob –>

manifest节点添加权限申请

<!– AdMob SDK permissions –>

/res/values/attrs.xml

<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”

xmlns:admobsdk=”http://schemas.android.com/apk/res/com.moandroid.livesports”

android:orientation=”vertical”

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”

<TextView

android:layout_width=”fill_parent”

android:layout_height=”wrap_content”

android:text=”@string/hello”

/>

<com.admob.android.ads.AdView

android:id=”@+id/ad”

android:layout_width=”fill_parent”

android:layout_height=”wrap_content”

admobsdk:backgroundColor=”#000000″

admobsdk:textColor=”#FFFFFF”

admobsdk:keywords=”Android application”

admobsdk:refreshInterval=”60″

/>

为免费app嵌入Admob广告,进而获得广告收入。

文章来自:http://www.moandroid.com/?p=1158

评论(4)

  1. #4 楼 · zdyhlp · 2011-11-22 09:54

    新版本4.3.1不能在Android2.2下工作。请问楼主用的哪个admob sdk

  2. #3 楼 · zdyhlp · 2011-11-21 11:57

    另外要加上ads:adSize="BANNER"

  3. #2 楼 · zdyhlp · 2011-11-21 11:43

    <com.admob.android.ads.AdView android:id=”@+id/ad” 貌似在新的admob sdk里要改成 <com.google.ads.AdView android:id="@+id/ad"

    不然会报错:Error inflating class com.admob.android.ads.AdView

  4. #1 楼 · lemonjesnme · 2011-03-16 21:39

    为什么有些ID可以,新申请的ID不行。

评论功能维护中,当前仅展示历史评论。