如何使用Cordova / Ionic在内置浏览器中显示AdMob横幅
问题描述:
我正在使用 ionic-framework
。我可以创建一个 admob
横幅,但是当我加载 inappbrowser
横幅时,直到关闭 inappbroswer
。
I'm using ionic-framework
. I can create an admob
banner, but when I load inappbrowser
the banner is not shown until I close the inappbroswer
.
是否有一种方法可以在 inappbrowser
中显示AdMob标语>是打开的吗?
Is there a way to show the AdMob banner when inappbrowser
is open?
答
我建议您使用我正在维护的该插件。您可以查看有关在加载cordova时如何启动admob的详细示例: https://github.com/appfeel/admob-google-cordova/wiki/Angular.js,-Ionic-apps
I reccomend you to use this plugin which I'm maintaining. You can see detailed examples on how to initiate admob when cordova is loaded: https://github.com/appfeel/admob-google-cordova/wiki/Angular.js,-Ionic-apps
var app = angular.module('myApp', ['admobModule']);
app.config(['admobSvcProvider', function (admobSvcProvider) {
// Optionally you can configure the options here:
admobSvcProvider.setOptions({
publisherId: "YOUR_PUBLISHER_ID", // Required
interstitialAdId: "YOUR_PUBLISHER_ID"
});
}]);
app.run(['admobSvc', function (admobSvc) {
$rootScope.$on('admob:' + admobSvc.events.onAdOpened, function onAdOpened(evt, e) {
console.log('adOpened: type of ad:' + e.adType);
});
}]);