【问题标题】:Phonegap Google AdMob interstitial add watched identificationPhonegap Google AdMob 插页式添加观看标识
【发布时间】:2016-04-04 08:41:13
【问题描述】:
我正在开发 phonegap android 应用程序,我在其中实现了 Google admob 目前我在页面底部显示横幅广告。为此我得到了phonegap-admob-demo的帮助
您可以在index.html页面link for index.html查看用于展示广告的Js代码
通过使用此代码,我能够成功展示横幅广告和插页式广告。
=======
现在我想检查用户是否成功观看了整个插页式广告。根据这一点,我想给用户额外的时间来使用该应用程序。因此,基本上我希望在且仅在观看整个插页式广告时才运行特定功能。
我该如何实现呢?请帮帮我
【问题讨论】:
标签:
android
cordova
admob
phonegap-plugins
【解决方案1】:
使用https://github.com/appfeel/admob-google-cordova 的插件,您可以测试是否已使用events 显示插页式广告:
document.addEventListener(admob.events.onAdLoaded, function (e) {
console.log(e.adType === admob.AD_TYPE.BANNER ? "Banner" : "Interstitial");
console.log("Called when an ad is received.");
});
document.addEventListener(admob.events.onAdOpened, function (e) {
console.log(e.adType === admob.AD_TYPE.BANNER ? "Banner" : "Interstitial");
console.log("Called when an ad opens an overlay that covers the screen. Please note that onPause event is raised when an interstitial is shown.");
});
document.addEventListener(admob.events.onAdClosed, function (e) {
console.log(e.adType === admob.AD_TYPE.BANNER ? "Banner" : "Interstitial");
console.log("Called when the user is about to return to the application after clicking on an ad. Please note that onResume event is raised when an interstitial is closed.");
});
document.addEventListener(admob.events.onAdLeftApplication, function (e) {
console.log(e.adType === admob.AD_TYPE.BANNER ? "Banner" : "Interstitial");
console.log("Called when an ad leaves the application (e.g., to go to the browser).");
});