Phonegap Google AdMob interstitial添加观看后的身份识别

时间:2016-04-04 08:41:14

标签: android cordova admob phonegap-plugins

我正在开发phonegap android应用程序,我已经实现了Google admob目前我正在页面底部显示横幅广告。为此,我接受了phonegap-admob-demo

的帮助

您可以查看Js代码,以便在index.htmllink for index.html

显示广告

通过使用此代码,我可以成功显示横幅广告和插页式广告。

=======

现在我想检查用户是否已成功观看整个非页内广告。根据我的想法,我希望为用户提供额外的时间来使用该应用程序。所以基本上我希望当且仅当观看整个插页式广告时才运行特定的功能。

我该如何实现?请帮帮我

1 个答案:

答案 0 :(得分:0)

使用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).");
});