admod无法在真实设备中显示

时间:2019-03-15 13:58:30

标签: flutter admob

我在应用中使用firebase_admob 0.8.0+3进行广告展示,它处于测试模式,但是当我部署到我的真实设备上时,它不起作用,有广告要在Android设备上展示,并且我刚在控制台中遇到以下错误:

W/flutter (11675): onAdFailedToLoad: 3
I/Ads     (11675): Ad failed to load : 3
I/flutter (11675): BannerAd event is MobileAdEvent.failedToLoad

但是当我尝试添加testDevice时,它可以显示带有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才能使其正常工作?!

2 个答案:

答案 0 :(得分:0)

如果您刚刚在admob中创建了adUnit ID,则可能会发生错误。因此,您需要等待一段时间(最多一天)以获取填充。

答案 1 :(得分:0)

好,仅供参考,当我将应用程序发布到应用程序商店和google play商店时,广告功能正在起作用,因此确实需要发布适用于作品的admod的应用程序!

相关问题