- 浏览: 434050 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
qja:
Iterator.remove()这个方法也会出错的。
java.util.ConcurrentModificationException 出现的原因和解决办法 -
angeli:
List<String> save = new A ...
java.util.ConcurrentModificationException 出现的原因和解决办法 -
大峰子:
灰常感谢 刚好碰到这个问题, 搜了好多都没找到解决方法
python学习笔记-Python交互模式下方向键出现乱码 -
anypwx:
牛哥,怎么找到的,解决了我的报错问题,谢谢
JSONObject NestableRuntimeException -
tp7300:
确实好很多了,谢谢博主。
Failed to install on device 'emulator-5554': timeout
在网上看到一篇Admob广告盈利模式详细教程,感觉不错,嘿嘿,搬过来供以后参考。
在这之前,你不需要有任何的帐号,唯一需要的就是有一个有效的email邮箱。只要按照下面的步骤一步步来,你就能通过将Admob的广告插到自己的程序中赚钱啦!
首先,当然是需要注册一个Admob的帐号。Admob的主页是:http://www.admob.com/ 。 当然,如果你对于浏览英文网页还有些障碍的话,可以登录中文网站:http://zhcn.admob.com/ 。如果网站的文字还是英文,你可以在网站主页的右下角的“Language”处,选择“中文(简体)”。点击进入注册页面后,有一些栏目需要填写,不要太过疑虑,就像你注册一个论坛一样,随便填下就好了。最关键的是保证填写的email地址有效,另外就是填上姓名,选择语言。帐户类型我选择的“不确定”,语言“中文(简体)”~ 提交注册申请之后,不久你就会收到用于确认并激活帐号的电子邮件,点击激活链接,就可以了激活你的Admob帐号了~
第二步就是设置你的Android应用程序信息,并获得Admob的插入代码。登录你的Admob帐号后,在主页的左上方(Logo上面)点击“Marketplace(手机广告市场)”,进入页面后,在“Sites&Apps(站点和应用程序)”标签下,点击“Add Site/App”。选择我们熟悉的图标——" Android App ” 。这时会出现需要你填写一个“详细信息”,随便填上一些信息。(不要太过在意现在填写的东西,因为这些以后都是可以修改的)。比如“Android Package URL” 我到现在都还没有填写,描述之类的,想写就写点吧。填好详细信息后,点击“继续”,就可以到AdMob Android SDK 的下载页面了。下载这个SDK(当然,这个很重要)。
The AdMob Android SDK includes:
README: Get started with AdMob Android ads!
AdMob Jar file: Required for publishing ads. Follow the documentation in javadoc/index.html and drop the AdMob Jar file into your project.
Sample Projects: Examples of AdMob Android ads shown in the LunarLander application.
第三步获取你的应用程序对应的Publisher ID。在下载页面点击"Go to Sites/Apps"就可以到你应用程序的管理界面了。这时你会发现在这个页面醒目的位置会有一个叫你填写详细信息的提示:
在我们发送任何有待收入之前,您需要填写技术联系详细信息和付款首选项。
我们暂时可以不用管它,因为钱是会存在我们的Admob的账户上的,等我们需要提现的时候,或者你想填的时候再填就可以了。在下面的列表中,选择你的应用程序并进入。这个界面就是你的应用程序广告的管理界面了,里面有比较多的功能,以后可以慢慢了解,现在我们只需要知道两个东西,一个是发布者 ID(Publisher ID),一个是你程序的状态。Publisher ID是一个15个字符的字符串,而你程序的状态现在应该还是不活动(Inactive)。我们下面要做的就是怎么让它变为Active。
第四步代码编写——在你的应用程序中插入Admob广告。经过上面的步骤,我们在网站上的设置就告一个段落了,现在我们终于要进入主题了,如何在自己的Android应用程序中插入Admob广告。如果你不健忘的话,一定还记得我们之前下载的那个AdMob Android SDK 。解压它,看看里面有些什么东西。这里面最重要的就是那个名为“admob-sdk-android.jar”的包啦,Admob将如何把广告加载到Android应用程序中的代码集成在这个包里,我们编写程序的时候就需要将这个包导入到我们的工程里面去。另外,解压出来的文件夹中还有一个名为“javadoc”的文件夹,打开它里面的index.html。它是关于Admob Android SDK的帮助文档,在Package 下的Setup下,有详细完整的在自己的应用程序中插入广告的方法介绍,在这里我就偷懒,引用一下~
Including the Jar
Add the Jar file included with the SDK to your Android project as an external library. In your project's root directory create a subdirectory libs (this will already be done for you if you used Android's activitycreator). Copy the AdMob Jar file into that directory. For Eclipse projects:
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
注意:需要首先在你工程的根目录下新建一个叫做“libs”的文件夹,并把之前所说的最重要的东西“admob-sdk-android.jar”复制到里面。
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 a1496ced2842262. 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" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>
Only the INTERNET permission is required. Setting ACCESS_COARSE_LOCATION (and/or ACCESS_FINE_LOCATION) allows narrowly geo-targeted ads be shown.
这里需要注意的是,<meta-data android:value="YOUR_ID_HERE" android:name="ADMOB_PUBLISHER_ID" />中,我们只需要改的是"YOUR_ID_HERE"。这里需要你填上的ID就是我们之前在Admob网站我们的应用程序管理页面上看到的Publisher ID,而name="ADMOB_PUBLISHER_ID"是不应该改的。程序需要这个Key来查找对应的Value。
attrs.xml
The attrs.xml file specifies custom AdView attributes in XML layout files. If your application does not already have an /res/values/attrs.xml file then create one and copy-and-paste the following into it. If you do have that file then just add the declare-styleable element:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="com.admob.android.ads.AdView">
<attr name="testing" format="boolean" />
<attr name="backgroundColor" format="color" />
<attr name="textColor" format="color" />
<attr name="keywords" format="string" />
<attr name="refreshInterval" format="integer" />
<attr name="isGoneWithoutAd" format="boolean" />
</declare-styleable>
</resources>
这个,没什么说的。
Placing an AdView in a Layout
AdView widgets can be put into any XML layout now. The first step is to reference attrs.xml in your layout element by adding an xmlns line that includes your package name specified in AndroidManifest.xml:
xmlns:yourapp=http://schemas.android.com/apk/res/yourpackage
For example a simple screen with only an ad on it would look like:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:admobsdk="http://schemas.android.com/apk/res/com.admob.android.example"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<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"
/>
</LinearLayout>
这里好像也没什么需要特别注意的,注意加上xmlns,另外知道这里可以设置一个keywords。
Test Mode
When you start integrating AdMob ads into your application it is recommended to use test mode. This always returns the same ad. Normal ad requests are not deterministic making it harder to be sure the ad view looks like you want (e.g. ad requests can timeout or may not fill).
Once the ad shows up as you expect be sure to turn test mode off to get real ads. Never put your application into the Android Market with test mode enabled.
Test mode can be enabled either by calling AdManager.setInTestMode(true) or by adding a "admobsdk:testing="true"" property to the ad in your XML layout (where "admobsdk" is the XML namespace for your application).
设置Test Mode这个很关键,千万别将处于Test Mode的程序发布出去了,那样可赚不了钱啊~!如果在AdView的属性中不加上admobsdk:testing="false",似乎程序也是不处于Test Mode的,不过最好还是加上吧~
第五步编译运行,并激活程序。编译运行你的程序,在模拟器上就可以看到效果啦~(当然你的模拟器需要能上网,关于怎么让模拟器上网呢?用路由的应该可以直接上,如果不是用路由,那么可能需要设置下,具体方法大家自己网上搜吧,具体忘了)。如果你的应用程序能显示出广告,那么恭喜你,你的应用程序很快就会在Admob上被激活了(需要一定的时间,我的好像花了一个小时不到)!
第六步在Admob网站上查看应用程序赚了多少钱~“手机广告市场”—>“报告”—>“站点和应用程序报告”。选择你的应用程序,然后点击页面最下面的“创建报告”~ OK,赚钱啦~
最后,我把我自己写的一个例子工程上传上来,大家可以下载来参考下。另外,我的工程将广告作为移动的,并且改变了它默认的宽度和背景,希望对如何在应用程序中摆放广告,起到一个抛砖引玉的作用。
本文转载自:http://dev.10086.cn/cmdn/wiki/index.php?doc-view-3424.html
- AdmobAdsExample.rar (270.5 KB)
- 下载次数: 76
发表评论
-
warning: libfmodex64.so, needed by ../../lib/linux/Debug/libcocosdenshion.so,
2012-03-13 01:20 1975linux环境下用cocos2d-x开发游戏时,遇到了 wa ... -
在工作线程中创建Toast
2011-10-14 18:11 3695在工作线程中创建Toast,代码如下: p ... -
GridView + ViewFlipper布局界面,模仿“机锋市场”
2011-10-09 18:22 2238源码在附件中,效果如图片 -
fedora14下连接android真机
2011-08-13 13:22 1357在fedora14下搭建好了andro ... -
fedora14下搭建Android开发环境
2011-07-12 23:59 2530一:下载linux版本的JDK,Eclipse,Andr ... -
简述android线程间消息处理机制(Looper、Handler和Message)
2011-06-17 21:51 7649作用:Android的线程间消息处理机制主要是用来处理主 ... -
Android中ImageButton实现“按下”效果
2011-06-16 12:26 7607使用Button的时候,实现“按下”的效果是很重要的,也 ... -
Android实现TCP与UDP传输
2011-05-21 14:50 5358关于TCP和UDP协议的描述,可参考http://zho ... -
android textview改变部分文字的颜色和string.xml中文字的替换
2011-05-18 18:49 17247一:TextView组件改变部分文字的颜色: Text ... -
AndroiManifest.xml文件中android属性
2011-05-16 11:59 1411android:allowTaskReparentin ... -
windows系统上安装与使用Android NDK r5
2011-01-26 13:17 11313windows系统上安装与使用Android NDK r ... -
android获取屏幕分辨率
2011-01-15 17:05 2096获取屏幕分辨率的代码: ... -
Android编译出现Multiple substitutions specified in non-positional format
2010-12-31 13:28 3831前段时间更新了ADT和Android SDK 2.3, ... -
TextView设置中文粗体
2010-12-30 13:25 5475在xml布局文件中设置android:textStyle=“b ... -
Failed to install on device 'emulator-5554': timeout
2010-12-20 10:41 6158Failed to install on device ... -
解决android logcat不打印信息
2010-11-30 19:06 7879用eclipse进行android开发中经常遇到logcat无 ... -
关于android设备的分辨率
2010-11-29 12:27 1958HVGA (Half-size VGA) 即VGA ... -
Toast的用法
2010-11-18 13:28 4584Toast是android中用来显示快速显示短信息的一种机制, ... -
listview的美化和优化
2010-11-17 13:54 4305在android开发中,listview是比较常用的一个组件, ... -
activity切换特效(类似iphone的进入和退出时的效果)
2010-11-10 23:11 3874关于activity的切换,有很多挺好看的动画实现,最近在项目 ...
相关推荐
android软件Admob广告盈利模式教程参考.pdf
AdMob广告接入教程.rar
admob广告android嵌入教程,软松实现广告收入
admob 广告 SDK IOS
2018-04-23: admob广告平台Demo测试手机需要谷歌全家桶!
演示Admob在android上的加载,包含原生广告,插页广告,横幅广告。需要源码的,私信我。
在嵌入admob广告时候,遇到很多麻烦,这篇教程帮了我不少的忙,如果你也为此感到困惑,那么可以参考试试!
iOS中加入iAD和ADMOB广告 原文地址:http://blog.csdn.net/ioswyl88219/article/details/19355069
教你如何在你的移动应用中添加谷歌admob的广告 请下载源码实例 已经所需要的lib库
此代码资源为goole admob广告展示的代码
Android平台AdMob广告添加方法,看完这个资料你就懂得如何投放google广告了。
android应用中添加admob广告的示例工程,原来上传那个可能有乱码问题吧,使用2012最新GoogleAdMobAdsSdk-4.3.1.jar,,这里我写了个小例子,可以给你学习参考使用,里面有详细注释,并添加了监听器,本例自己运行没...
Android添加AdMob广告流程 连接AdMob官方网站http://zhcn.admob.com 注册后登录 进入自己的服务中心->站点和应用程序->添加网站/应用程序->Android应用程序->填写详细信息(在填写url的时候填写AndroidManifest.xml...
google admob广告SDK官方DEMO下载
IPhone弹出基于Phonegap的工程的Admob广告
unity admob 广告接入 demo,android ,ios 均以接入,内含apk可测试,替换相应的id 即可。
google admob广告android嵌入代码
详细讲解:https://blog.csdn.net/weixin_41843959/article/details/119682017 这个demo在虚拟器上会出现,调用广告有时候会出现Cannot find an ad network adapter with the name(s): ...
AdMob广告添加流程 连接AdMob官方网站http://zhcn.admob.com 注册后登录 进入自己的服务中心->站点和应用程序->添加网站/应用程序->Android应用程序->填写详细信息(在填写url的时候填写AndroidManifest.xml中的url...
可能你会想先测试下admob广告,那么你可以使用测试模式,或者你的应用是儿童应用,需要设置儿童应用模式可以通过下面的方法进行 using admob; ... Admob.Instance().setTesting(true); Admob.Instance()....