- 浏览: 1124286 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (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 1148转自:http://www.oschina.net/ques ... -
CocoStudio简介
2014-03-05 19:19 1422一、概述 1.1.功能简介 CocoS ... -
xcode5预览版下载地址
2013-06-16 09:56 22361.xcode5预览版下载地址 http://adcdo ... -
解决提交应用到AppStore时,提示UUID及UIDevice错误
2013-06-04 03:34 22991.如果使用了Admob,更新到最新版本6.4.2,删除Add ... -
解决Could not instantiate class named NSLayoutConstraint
2013-02-17 10:22 1452点击xib或storyboard文件,在右边的 inspect ... -
objective-c的arc项目中使用不支持arc的依赖库时编译错误的解决
2013-02-06 14:04 1179在Target->build phases->Co ... -
xcode4.6下载地址
2013-02-04 12:08 3108http://adcdownload.apple.com/De ... -
Mac上的DMG与ISO互转
2013-01-14 14:59 12101.把DMG转为ISO hdiutil convert /p ... -
设置ios中DatePicker的日期为中文格式
2012-12-18 18:12 72651.在模拟器中的“设置”-“通用”-“多语言环境”-“语言”设 ... -
Xcode 错误- Could not launch app - No such file or directory Error.
2012-12-14 11:50 1881通常发生在联机调试过程中,新旧工程交替测试 解决方 ... -
UIPickerView控件中自定义显示的字体大小及样式
2012-12-14 00:21 17798通过覆盖如下方法实现 - (UIView *)pickerV ... -
Flurry analytics SDK集成步骤及功能简介
2012-12-13 11:48 15445Flurry analytics SDK集成步骤及功能 ... -
Xcode4中显示“Line Numbers”行号
2012-12-11 10:46 1160Xcode4中显示“Line Numbers”行号 1 ... -
ios代码备忘
2012-12-09 00:23 14601.自定义导航栏返回按钮 self.navigationIt ... -
iOS OpenSource Library Collection
2012-12-07 17:45 1359转自:http://www.cppblog.com/inkcp ... -
ios内置付费IAP校验
2012-12-07 15:50 1619参考链接:http://developer.apple.com ... -
ios应用中集成多盟广告墙
2012-12-06 16:59 35691.下载广告墙SDK最新版 ... -
ios 导航栏、工具栏、tab栏图标大小
2012-12-06 16:50 11342工具栏和导航栏上的图标尺寸应如下所示: 对于iPhoe和iP ... -
【转】Google Admob 广告最佳做法
2012-11-13 15:40 6583转自:https://developers.google.co ... -
【转】Google AdMob 广告 iOS 初级指南
2012-11-13 15:37 1542转自:https://developers.google.co ...
相关推荐
本教程将详细介绍如何在iOS应用中集成两种常见的广告网络:Apple的iAD和Google的ADMOB。 首先,我们来了解这两个广告平台的基础知识: 1. **iAD**:由Apple提供,是专门为iOS和OS X设备设计的内置广告解决方案。...
AdMob SDK for iOS是专门为苹果设备优化的版本,允许开发者在其应用程序中无缝地展示各种类型的广告,如横幅广告、插屏广告、激励视频广告等。本文将详细介绍AdMob SDK for 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,但在真机上没问题,...
【标题】"IOS应用源码之Ads(AdMob+iAd)Demo.zip" 指的是一份包含了iOS应用中广告集成的源代码示例,主要使用了Google的AdMob和苹果的iAd两个广告网络。这份源代码可以作为开发者学习如何在iOS应用中集成和管理广告的...
AdMob是Google提供的一款强大的移动广告平台,它允许开发者在Android和iOS应用中展示各种类型的广告,如横幅广告、插屏广告、激励视频广告等,从而实现盈利。本教程将详细讲解如何将AdMob广告接入到您的应用程序中,...
iOS AdMob SDK是Google提供的一个广告平台,专为iOS开发者设计,用于在他们的应用程序中集成广告。AdMob提供了一个简单、高效的方法来展示各种类型的广告,包括横幅广告、插屏广告和激励视频广告,帮助开发者实现...
AdMob是Google提供的一款强大的移动广告平台,专为开发者设计,用于在他们的应用程序中嵌入广告,从而实现盈利。这个“admob广告平台Demo”很可能是一个包含示例代码和配置文件的项目,帮助开发者理解如何在自己的...
AdMob是Google提供的一款强大的移动广告平台,它允许开发者在自己的应用程序中展示各种类型的广告,如横幅广告、插屏广告和原生广告。本教程将详细介绍如何在Android应用中集成AdMob广告。 首先,确保你已经拥有一...
AdMob是一款强大的移动广告平台,它允许开发者在iOS和Android应用中轻松集成和展示广告。以下是关于如何在iOS程序中使用AdMob添加广告的详细步骤和知识点: 1. **集成AdMob SDK** 首先,你需要从Google的开发者...
值得注意的是,AdMob有严格的政策和规定,比如禁止频繁请求广告、虚假点击等,所以务必遵守AdMob的使用条款,以避免账户被封禁。 最后,测试你的广告功能,确保它们在模拟器和真机设备上都能正常工作。在发布应用前...
AdMob是Google提供的一款强大的移动广告平台,它允许开发者在Android和iOS应用中集成广告,以实现盈利。本文将深入探讨AdMob广告展示的相关知识点,包括AdMob的基本概念、广告类型、集成步骤以及优化策略。 一、...
Admob是Google提供的一款强大的移动广告平台,广泛用于Android和iOS应用中,为开发者提供了多种广告格式,包括原生广告、插页广告和横幅广告。在这个“Admob广告加载示例”中,我们将深入探讨如何在Android应用程序...
在移动应用开发领域,iOS平台和Google AdMob的广告整合是一项常见的需求,旨在扩大广告覆盖面,提高收益。本文将深入探讨如何在iOS应用中整合iAd(苹果原生广告服务)与AdMob(谷歌的广告网络平台),以及如何做到无...
开发者可以通过在 Android 应用程序中添加 Admob 广告,来赚取收入。 二、为什么要使用 Admob? 使用 Admob 可以帮助开发者赚取收入,提高应用程序的商业价值。Admob 提供了多种广告格式,包括-banner 广告、插页...
- 配置AdMob的App ID和广告单元ID。 - 在Air应用中添加必要的代码以请求和显示广告。 - 测试广告在模拟器或实际设备上的表现。 6. **实例演示**:教程可能包含具体的代码示例,展示如何在ActionScript或...
AdMob是Google提供的一款强大的移动广告平台,它允许开发者在iOS和Android应用中轻松集成广告,从而实现盈利。AdMob ANE(Adobe Native Extension)是为了让Adobe Air开发者能够方便地在iOS应用程序中接入AdMob服务...
AdMob是谷歌提供的一个强大且广泛使用的移动广告平台,它允许开发者在他们的应用程序中展示各种类型的广告,包括横幅广告、插屏广告和激励视频广告,从而实现盈利。本文将详细介绍如何在Android应用中集成AdMob广告...
在iOS应用开发中,将adMob移动广告集成到iPad或iPhone应用中是常见的盈利和推广方式。adMob是由Google提供的一项服务,它允许开发者在他们的应用程序中展示广告,从而赚取收入。本教程将深入探讨如何在iPad和iPhone...
开发者可以结合应用内购买(IAP)和广告策略,为用户提供无广告体验的同时,提供付费升级选项。这样既能满足不同用户的需求,也能增加收入来源。 ### 6. GDPR和用户隐私 由于GDPR(欧洲通用数据保护条例)的实施,...
AdMob 是谷歌提供的一项移动广告平台服务,允许开发者在其应用程序中嵌入广告,以此实现盈利。AdMob 提供了多种广告格式,包括横幅广告、插屏广告、激励视频广告等,适用于不同类型的移动应用。 **集成 AdMob** 在...