- 浏览: 1097129 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (349)
- javascript (28)
- objective-c&cocos2d (46)
- 开发备忘及常用java代码 (46)
- core java7学习笔记 (13)
- Mina (7)
- HTML5 (13)
- 系统集成项目管理工程师学习笔记 (10)
- 数据库系统原理学习笔记 (11)
- C++学习笔记 (10)
- C语言学习笔记 (5)
- 数据结构学习笔记 (4)
- 计算机网络原理学习笔记 (3)
- 计算机组成原理学习笔记 (2)
- 软件工程学习笔记 (6)
- 开发工具 (15)
- OSGI学习 (1)
- 学习笔记 (19)
- oracle (3)
- java tv (1)
- web server (5)
- javafx (1)
- 随笔 (8)
- 梦舞集 (4)
- 工作流 (3)
- 程序错误记录 (6)
- Windows (2)
- Linux (4)
- Git (1)
- 企业管理 (2)
- android (1)
- JVM (17)
- box2dweb (1)
- 操作系统学习笔记 (6)
- 英语学习 (1)
- Windows 8 应用商店 (1)
- Go语言 (1)
- docker (1)
- visualVM源码学习 (0)
- MariaDB (0)
- JAVA7 (2)
- 面向对象存储 (0)
- Hibernate (14)
- Spring (3)
- 项目构建 (0)
- 读源码学JAVA (0)
- mybatis (1)
- spring mvc (2)
- Javassist (0)
最新评论
-
白天看黑夜:
Apache Mina Server 2.0 中文参考手册(带 ...
Mina学习笔记二_基础 -
yjph83:
兄弟,你这个解决方案是什么什么啊?我现在遇到个问题跟你类似的! ...
Tomcat 8.0.11 移动端访问报400错误问题 -
comedsh:
你好,我也想为开源的做点事情,想让 tomcat-redis- ...
利用tomcat-redis-session-manager做session同步时自定义类对象属性保存不上的解决方法 -
bsr1983:
这个应该是浏览器内部设置的,你可以在Android上试一下别的 ...
javascript学习笔记八 -
787250527:
bsr1983 写道该值是浏览器内部的一个变量,只读的,不可修 ...
javascript学习笔记八
因应用需求,需要做一个检测用户点击admob的功能,google上搜索了一圈,没有找到想要的答案,最终只能自己动手,查阅了admob的ios SDK中的几个头文件后,找到了相关的方法,具体如下:
应用中使用的是admob的广告条,即GADBannerView,如要检测GADBannerView相关的事件,如接收广告完成,用户点击广告,用户切回应用等事件,需要实现GADBannerViewDelegate,主要包括的方法如下:
// Sent when an ad request loaded an ad. This is a good opportunity to add this
// view to the hierarchy if it has not yet been added. If the ad was received
// as a part of the server-side auto refreshing, you can examine the
// hasAutoRefreshed property of the view.
- (void)adViewDidReceiveAd:(GADBannerView *)view;
// Sent when an ad request failed. Normally this is because no network
// connection was available or no ads were available (i.e. no fill). If the
// error was received as a part of the server-side auto refreshing, you can
// examine the hasAutoRefreshed property of the view.
- (void)adView:(GADBannerView *)view
didFailToReceiveAdWithError:(GADRequestError *)error;
#pragma mark Click-Time Lifecycle Notifications
// Sent just before presenting the user a full screen view, such as a browser,
// in response to clicking on an ad. Use this opportunity to stop animations,
// time sensitive interactions, etc.
//
// Normally the user looks at the ad, dismisses it, and control returns to your
// application by calling adViewDidDismissScreen:. However if the user hits the
// Home button or clicks on an App Store link your application will end. On iOS
// 4.0+ the next method called will be applicationWillResignActive: of your
// UIViewController (UIApplicationWillResignActiveNotification). Immediately
// after that adViewWillLeaveApplication: is called.
- (void)adViewWillPresentScreen:(GADBannerView *)adView;
// Sent just before dismissing a full screen view.
- (void)adViewWillDismissScreen:(GADBannerView *)adView;
// Sent just after dismissing a full screen view. Use this opportunity to
// restart anything you may have stopped as part of adViewWillPresentScreen:.
- (void)adViewDidDismissScreen:(GADBannerView *)adView;
// Sent just before the application will background or terminate because the
// user clicked on an ad that will launch another application (such as the App
// Store). The normal UIApplicationDelegate methods, like
// applicationDidEnterBackground:, will be called immediately before this.
- (void)adViewWillLeaveApplication:(GADBannerView *)adView;
参阅其中的注释可知,常用的方法为:
//客户端接收到广告后调用
- (void)adViewDidReceiveAd:(GADBannerView *)view
{
}
//用户点击广告后调用
- (void)adViewWillPresentScreen:(GADBannerView *)adView
{
NSLog(@"用户点击");
}
//用户点击广告后切换回游戏时
- (void)adViewDidDismissScreen:(GADBannerView *)adView
如果当前存在多个广告栏,可通过检测adView参数的值获取当前产生事件的广告栏对象,实现对应功能。
具体做法是,编写一个类,实现GADBannerViewDelegate,然后在需要检测事件的GADBannerView上设置对应的代理,代码为:
adView.delegate=自定义的实现了GADBannerViewDelegate协议的类对象;
-------------------------------------分割线--------------------------
2012年11月2日 补充
google的admob SDK在不同版本的ios下,点击广告条,所产生的事件是不同的,在ios6.0的ipad中,用户点击广告后调用
- (void)adViewWillPresentScreen:(GADBannerView *)adView
用户切回游戏中时,调用
- (void)adViewDidDismissScreen:(GADBannerView *)adView
但在ios5的iphone中,用户点击广告后调用的却是:
- (void)adViewWillLeaveApplication:(GADBannerView *)adView
用户切回游戏时无事件
应用中使用的是admob的广告条,即GADBannerView,如要检测GADBannerView相关的事件,如接收广告完成,用户点击广告,用户切回应用等事件,需要实现GADBannerViewDelegate,主要包括的方法如下:
// Sent when an ad request loaded an ad. This is a good opportunity to add this
// view to the hierarchy if it has not yet been added. If the ad was received
// as a part of the server-side auto refreshing, you can examine the
// hasAutoRefreshed property of the view.
- (void)adViewDidReceiveAd:(GADBannerView *)view;
// Sent when an ad request failed. Normally this is because no network
// connection was available or no ads were available (i.e. no fill). If the
// error was received as a part of the server-side auto refreshing, you can
// examine the hasAutoRefreshed property of the view.
- (void)adView:(GADBannerView *)view
didFailToReceiveAdWithError:(GADRequestError *)error;
#pragma mark Click-Time Lifecycle Notifications
// Sent just before presenting the user a full screen view, such as a browser,
// in response to clicking on an ad. Use this opportunity to stop animations,
// time sensitive interactions, etc.
//
// Normally the user looks at the ad, dismisses it, and control returns to your
// application by calling adViewDidDismissScreen:. However if the user hits the
// Home button or clicks on an App Store link your application will end. On iOS
// 4.0+ the next method called will be applicationWillResignActive: of your
// UIViewController (UIApplicationWillResignActiveNotification). Immediately
// after that adViewWillLeaveApplication: is called.
- (void)adViewWillPresentScreen:(GADBannerView *)adView;
// Sent just before dismissing a full screen view.
- (void)adViewWillDismissScreen:(GADBannerView *)adView;
// Sent just after dismissing a full screen view. Use this opportunity to
// restart anything you may have stopped as part of adViewWillPresentScreen:.
- (void)adViewDidDismissScreen:(GADBannerView *)adView;
// Sent just before the application will background or terminate because the
// user clicked on an ad that will launch another application (such as the App
// Store). The normal UIApplicationDelegate methods, like
// applicationDidEnterBackground:, will be called immediately before this.
- (void)adViewWillLeaveApplication:(GADBannerView *)adView;
参阅其中的注释可知,常用的方法为:
//客户端接收到广告后调用
- (void)adViewDidReceiveAd:(GADBannerView *)view
{
}
//用户点击广告后调用
- (void)adViewWillPresentScreen:(GADBannerView *)adView
{
NSLog(@"用户点击");
}
//用户点击广告后切换回游戏时
- (void)adViewDidDismissScreen:(GADBannerView *)adView
如果当前存在多个广告栏,可通过检测adView参数的值获取当前产生事件的广告栏对象,实现对应功能。
具体做法是,编写一个类,实现GADBannerViewDelegate,然后在需要检测事件的GADBannerView上设置对应的代理,代码为:
adView.delegate=自定义的实现了GADBannerViewDelegate协议的类对象;
-------------------------------------分割线--------------------------
2012年11月2日 补充
google的admob SDK在不同版本的ios下,点击广告条,所产生的事件是不同的,在ios6.0的ipad中,用户点击广告后调用
- (void)adViewWillPresentScreen:(GADBannerView *)adView
用户切回游戏中时,调用
- (void)adViewDidDismissScreen:(GADBannerView *)adView
但在ios5的iphone中,用户点击广告后调用的却是:
- (void)adViewWillLeaveApplication:(GADBannerView *)adView
用户切回游戏时无事件
发表评论
-
[转]解决 Xcode 删除文件后 missing file 警告
2014-03-19 18:19 1068转自:http://www.oschina.net/ques ... -
CocoStudio简介
2014-03-05 19:19 1362一、概述 1.1.功能简介 CocoS ... -
xcode5预览版下载地址
2013-06-16 09:56 21671.xcode5预览版下载地址 http://adcdo ... -
解决提交应用到AppStore时,提示UUID及UIDevice错误
2013-06-04 03:34 22001.如果使用了Admob,更新到最新版本6.4.2,删除Add ... -
解决Could not instantiate class named NSLayoutConstraint
2013-02-17 10:22 1369点击xib或storyboard文件,在右边的 inspect ... -
objective-c的arc项目中使用不支持arc的依赖库时编译错误的解决
2013-02-06 14:04 1113在Target->build phases->Co ... -
xcode4.6下载地址
2013-02-04 12:08 3042http://adcdownload.apple.com/De ... -
Mac上的DMG与ISO互转
2013-01-14 14:59 10851.把DMG转为ISO hdiutil convert /p ... -
设置ios中DatePicker的日期为中文格式
2012-12-18 18:12 71771.在模拟器中的“设置”-“通用”-“多语言环境”-“语言”设 ... -
Xcode 错误- Could not launch app - No such file or directory Error.
2012-12-14 11:50 1773通常发生在联机调试过程中,新旧工程交替测试 解决方 ... -
UIPickerView控件中自定义显示的字体大小及样式
2012-12-14 00:21 17733通过覆盖如下方法实现 - (UIView *)pickerV ... -
Flurry analytics SDK集成步骤及功能简介
2012-12-13 11:48 15291Flurry analytics SDK集成步骤及功能 ... -
Xcode4中显示“Line Numbers”行号
2012-12-11 10:46 1037Xcode4中显示“Line Numbers”行号 1 ... -
ios代码备忘
2012-12-09 00:23 13991.自定义导航栏返回按钮 self.navigationIt ... -
iOS OpenSource Library Collection
2012-12-07 17:45 1307转自:http://www.cppblog.com/inkcp ... -
ios内置付费IAP校验
2012-12-07 15:50 1521参考链接:http://developer.apple.com ... -
ios应用中集成多盟广告墙
2012-12-06 16:59 34801.下载广告墙SDK最新版 ... -
ios 导航栏、工具栏、tab栏图标大小
2012-12-06 16:50 11162工具栏和导航栏上的图标尺寸应如下所示: 对于iPhoe和iP ... -
【转】Google Admob 广告最佳做法
2012-11-13 15:40 6518转自:https://developers.google.co ... -
【转】Google AdMob 广告 iOS 初级指南
2012-11-13 15:37 1455转自:https://developers.google.co ...
相关推荐
iOS中加入iAD和ADMOB广告 原文地址:http://blog.csdn.net/ioswyl88219/article/details/19355069
admob 广告 SDK IOS
这个demo在虚拟器上会出现,调用广告有时候会出现Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs,但在真机上没问题,...
如何在Android应用中嵌入 AdMob 广告,里面有个文档和一个 AdmobDemo
ios admob sdk的简单用法。AdMob 是移动电话广告市场。很方便在自己的APP里加入。用法很简单。
Admob Unity Plugin Admob Unity 插件提供了一种在 Unity3D Game 和 u3d 应用程序中集成 admob 广告的方法
AdMob广告接入教程.rar
2018-04-23: admob广告平台Demo测试手机需要谷歌全家桶!
Admob ane for ios , 可以给Ios 添加Admob 广告
演示Admob在android上的加载,包含原生广告,插页广告,横幅广告。需要源码的,私信我。
IOS应用源码之Ads(AdMob+iAd)Demo.zip
教你如何在你的移动应用中添加谷歌admob的广告 请下载源码实例 已经所需要的lib库
admob广告android嵌入教程,软松实现广告收入
Android添加AdMob广告流程 连接AdMob官方网站http://zhcn.admob.com...进入自己的服务中心->站点和应用程序->添加网站/应用程序->Android应用程序->填写详细信息(在填写url的时候填写AndroidManifest.xml中的url包名)
IOS下使用,编译出xcode工程后需要在xCode中设置一下,引入以下Framework: AdSupport.framework,EventKit.framework,EventKitUI.framework,CoreTelephony.framework,StoreKit.framework,MessageUI.framework 并且...
android应用中添加admob广告的示例工程,原来上传那个可能有乱码问题吧,使用2012最新GoogleAdMobAdsSdk-4.3.1.jar,,这里我写了个小例子,可以给你学习参考使用,里面有详细注释,并添加了监听器,本例自己运行没...
Admob横幅广告和全屏广告都有差不多的广告事件,你可以在unity3d里面监听并处理所有admob广告事件 下面是一个处理全屏广告事件的例子,我们在收到广告的时候就展示广告 using admob; ... Admob.Instance()....
Haxe AdMob 针对iOS和Android Haxe OpenFL目标的非官方AdMob标语和插页式广告支持。 在查看演示应用程序。特征支持: 缓存,显示和关闭插页式广告。 显示,隐藏和刷新横幅广告。 可定制的侦听器,用于对SDK事件做出...
此代码资源为goole admob广告展示的代码
AdMob广告添加流程 连接AdMob官方网站http://zhcn.admob.com ...进入自己的服务中心->站点和应用程序->添加网站/应用程序->Android应用程序->填写详细信息(在填写url的时候填写AndroidManifest.xml中的url包名)