【发布时间】:2019-03-15 13:58:29
【问题描述】:
我在我的应用程序中使用firebase_admob 0.8.0+3 显示 admob,它在测试模式下工作,但是当我部署到我的真实设备时,它不起作用,在 android 设备上显示广告,我只是在控制台中出现以下错误:
W/flutter (11675): onAdFailedToLoad: 3
I/Ads (11675): Ad failed to load : 3
I/flutter (11675): BannerAd event is MobileAdEvent.failedToLoad
但是当我尝试添加 testDevices 时,它可以显示带有Test Ad 标签的广告
在 iOS 中的另一种方式,它可以在我的 iPhone 8+ 中显示广告,但无法在其他 iOS 设备中显示,我只是怀疑为什么以及如何修复它?
请查看以下代码:
FirebaseAdMob.instance.initialize(appId: appId);
MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
keywords: <String>['flutterio', 'beautiful apps'],
contentUrl: 'https://flutter.io',
birthday: DateTime.now(),
childDirected: false
// testDevices: <String>[
// 'FBBACD1EFD1C957AEF3087B3C9074B8F'
// ], // Android emulators are considered test devices
);
myBanner = BannerAd(
// Replace the testAdUnitId with an ad unit id from the AdMob dash.
// https://developers.google.com/admob/android/test-ads
// https://developers.google.com/admob/ios/test-ads
adUnitId: appUnitId,
size: AdSize.smartBanner,
targetingInfo: targetingInfo,
listener: (MobileAdEvent event) {
print("BannerAd event is $event");
},
);
我是否需要发布到 google play 才能正常运行?!
【问题讨论】: