【发布时间】:2017-01-09 07:27:55
【问题描述】:
直升机。我正在使用 Admob cordova 插件在我的基于离子的应用程序中显示广告。但是,我收到黑色空白横幅,在 android logcat 中出现此错误: JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined 我用谷歌搜索并对其进行了stackowerflowed,但找不到解决方案。我能做些什么?我是 sugin 插件,因为它在 git repo 中进行了解释。我认为问题出在sdk上。谢谢。
我的离子就绪代码部分如下所示:
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
window.plugins.AdMob.setOptions( {
publisherId: 'ca-app-pub-*****/*****',
bannerAtTop: false, // set to true, to put banner at top
overlap: false, // set to true, to allow banner overlap webview
offsetTopBar: false, // set to true to avoid ios7 status bar overlap
isTesting: false, // receiving test ad
autoShow: true // auto show interstitial ad when loaded
});
// display the banner at startup
window.plugins.AdMob.createBannerView();
});
******编辑************
现在启动几个应用程序后,我在 logcat 中收到此错误,并且仍然是黑色和空白横幅广告。
“接收器错误 Http 响应代码:403”
“获取广告响应时出现问题。错误代码:0”
“未能加载广告:0”
http://i.stack.imgur.com/g8wQA.png
http://i.stack.imgur.com/2E4Q1.png
****** 最终编辑 *********
最后我可以在我的应用中看到测试广告。我认为如果您使用 admob 插件而没有测试模式,admob 会阻止您的 id。我将使用生产模式更新 Play Store 上的应用程序。我会写出结果
【问题讨论】:
-
请添加您的代码和日志
-
在测试模式下是否展示广告?
-
是的,现在可以了。我正在使用生产模式在 google play store 上进行更新,希望它能工作:)
标签: android cordova ionic-framework admob cordova-admob