AndriousSolutions / ads

Other
58 stars 11 forks source link

Ads version 3.0.0 (nullsafe) Video not showing up #39

Open Marek00Malik opened 3 years ago

Marek00Malik commented 3 years ago

Hello there. Just wanted to ask if there is anything new how should we display the video ads in the beta version of the null-safe version?

This is my code:

static Future<bool> showRewardAd({required Function userReward, required Function onAdClose}) async {
    return getInstance().setVideoAd(
        show: true,
        testDevices: [],
        childDirected: false,
        adUnitId: AdManager._rewardedAdUnitId,
        contentUrl: 'https://makromapa.pl',
        keywords: <String>['food', 'fit', 'calories'],
        listener: (AdsEvent event, {String? rewardType, int? rewardAmount}) {
          if ([AdsEvent.onAdLoaded, AdsEvent.onAdOpened, AdsEvent.onAppEvent].contains(event)) {
            _logger.d("Reward Ad | Following RewardedVideoAd Event was fired - $event");
            SystemChrome.setEnabledSystemUIOverlays([]);
          }

          if (AdsEvent.onRewardedAdUserEarnedReward == event) {
            _logger.i("Reward Ad | User granted reward - $rewardType, ($rewardAmount)");
            userReward();
          }

          if (AdsEvent.onAdFailedToLoad == event) {
            _logger.e("Reward Ad | failed to load Reward Ad");
            onAdClose();
          }

          if (AdsEvent.onAdClosed == event) {
            _logger.e("Reward Ad | closed");
            onAdClose();
            SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
          }
        })
    .then((value) => getInstance().showVideoAd());
  }

...
static Ads getInstance() {
    if (_ads != null) {
      return _ads!;
    }

    _ads = Ads(
      trackingId: AdManager._appId,
      videoUnitId: AdManager._rewardedAdUnitId,
      testing: false,
      testDevices: [],
      childDirected: false,
      contentUrl: 'https://example.pl',
      keywords: <String>['test'],
      listener: _eventListener,
    );

    return _ads!;
  }

The listener gets with the AdsEvent.onAdLoaded event. There isn't anything else fired. This flow worked on the older version ;

Andrious commented 3 years ago

I will look into this tomorrow---Friday. There have been some updates to the plugin, but I feel it should still worik.

Marek00Malik commented 2 years ago

Any news on this? Because of this, I'm still on the 2.x version. With this version, I'm having problems running on iOS. I'm getting errors when compiling, CocoaPods is complaining about firebase_admob and its outdated dependency on Google-Mobile-Ads-SDK.

[!] CocoaPods could not find compatible versions for pod "Google-Mobile-Ads-SDK":
  In Podfile:
    Google-Mobile-Ads-SDK (~> 7.69.0)

    firebase_admob (from `.symlinks/plugins/firebase_admob/ios`) was resolved to 0.11.2, which depends on
      Google-Mobile-Ads-SDK (= 7.49.0)

Specs satisfying the `Google-Mobile-Ads-SDK (~> 7.69.0), Google-Mobile-Ads-SDK (= 7.49.0)` dependency were found, but they required a higher minimum deployment target.

I'm not sure if you are using firebase_admob, but it should be now moved as the development has been stopped.

Andrious commented 2 years ago

A release will be made available this week if not this evening.

Andrious commented 2 years ago

ads 3.0.1 has been released. Please, notify me of any issues.