Admob - 横幅显示黑色背景,没有广告 [英] Admob - The banner shows a black background and no ad
问题描述
我正在使用 Ionic Framework 和此插件:
< blockquote>
https://github.com/floatinghotpot/cordova-plugin- admob
当我将应用程式部署到Android手机时,我看到一个黑色矩形,但没有广告。 p>
我真的不知道发生了什么..这是我的代码:
$ ionicPlatform.ready(function(){
// Admob
var am = window.plugins.AdMob;
am.createBannerView(
{
'publisherId':'xxxxxxxxxx',
'adSize':am.AD_SIZE.SMART_BANNER,
'bannerAtTop':false
},
function(){
am.requestAd(
{
'isTesting':true
},
function b am.showAd(true);
},
function(){
/ *处理错误* /
}
);
},
function(){
/ *处理错误* /
}
);
});
当您安装上一个admob时,Google Play服务插件也会安装插入。如果有人可以帮助我,我会真的很感激。提前感谢
我注意到您将isTesting设置为true。如果您使用Android模拟器,当您处于此模式时,它可能无法呈现广告。
同时确保您使用的发布商ID正确无误。我知道它有时可能会混淆,因为Admob提供了几种可能性来选择。
我在我的博客上发布了一篇关于如何让Admob使用IonicFramework的文章。可以在这里找到:
https://www.thepolyglotdeveloper.com/2014/06/using-admob-ionicframework/
如果仍然无法使用,让我们知道,我们可以从那里解决。
干杯,
I'm using Ionic Framework, and this plugin:
When I deployed the app to the android phone, I see a black rectangle, but no ad.
I don't really know what's happening.. This is my code:
$ionicPlatform.ready(function() {
//Admob var am = window.plugins.AdMob; am.createBannerView( { 'publisherId': 'xxxxxxxxxx', 'adSize': am.AD_SIZE.SMART_BANNER, 'bannerAtTop': false }, function() { am.requestAd( { 'isTesting': true }, function() { am.showAd(true); }, function() { /* Handle error */ } ); }, function() { /* Handle error */ } ); });
Google play services plugin is also installed when you installed the previous admob plugin. If anyone can help me, I would really appreciate it. Thanks in advance
I noticed that you set isTesting to true. If you are using the Android simulator it may not render ads when you are in this mode.
Also make sure that you are in fact using the correct publisher id. I know it can sometimes be confusing since Admob gives a few possibilities to choose from.
I made a post on how to get Admob working with IonicFramework on my blog. It can be found here:
https://www.thepolyglotdeveloper.com/2014/06/using-admob-ionicframework/
If that still doesn't work, let us know and we can troubleshoot from there.
Cheers,
这篇关于Admob - 横幅显示黑色背景,没有广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!