Android emulator中未显示横幅广告
我有这段代码用于在Android模拟器中测试bannerads。我有适当的进口商品。调用Android emulator中未显示横幅广告,android,ionic-framework,emulation,ads,Android,Ionic Framework,Emulation,Ads,我有这段代码用于在Android模拟器中测试bannerads。我有适当的进口商品。调用this.showBannerAd()将停止emulator启动应用程序。在这方面的任何投入都会有所帮助 构造函数代码: constructor( platform: Platform, private admobFree: AdMobFree, ) { if (!platform.is('c
this.showBannerAd()
将停止emulator启动应用程序。在这方面的任何投入都会有所帮助
构造函数代码:
constructor( platform: Platform,
private admobFree: AdMobFree,
) {
if (!platform.is('core')) {
this.showBannerAd();
}
}
async showBannerAd(){
const bannerConfig: AdMobFreeBannerConfig = {
isTesting: true,
autoShow: true
}
this.admobFree.banner.config(bannerConfig);
try {
const result = this.admobFree.banner.prepare();
console.log("Admob result: ", result)
}
catch(e) {
console.error(e);
}
}
在开发过程中启用测试广告非常重要,因为Google
不允许开发者在应用程序运行时使用真正的横幅
发展
有两种方法可以实现这一点:
使用横幅Idca-app-pub-3940256099942544/630978111
或使用填隙式
ca-app-pub-3940256099942544/1033173712
重新运行你的应用程序。如果广告是谷歌广告,你会看到一个测试广告标签在广告顶部居中(横幅、间隙或奖励视频)
在开发过程中启用测试广告非常重要,因为Google
不允许开发者在应用程序运行时使用真正的横幅
发展
有两种方法可以实现这一点:
使用横幅Idca-app-pub-3940256099942544/630978111
或使用填隙式
ca-app-pub-3940256099942544/1033173712
重新运行你的应用程序。如果广告是谷歌广告,你会看到广告顶部有一个测试广告标签(横幅、插页或奖励视频)。我不知道答案(甚至可能不会提供更多信息),但如果你能添加你的模拟器使用的安卓版本,肯定会对回答者有所帮助。此外,这只会发生在模拟器上,还是也会发生在你的硬件手机上?我不知道答案(甚至可能不会提供更多信息),但如果你能添加你的模拟器正在使用的android版本,肯定会对回答者有所帮助。此外,它是否只发生在模拟器上,或者也发生在您的硬件手机上?