Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Marek00Malik opened this issue Jul 7, 2021 · 4 comments
Open

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

Marek00Malik opened this issue Jul 7, 2021 · 4 comments

Comments

@Marek00Malik
Copy link

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
Copy link
Member

Andrious commented Jul 8, 2021

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

@Marek00Malik
Copy link
Author

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
Copy link
Member

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

@Andrious
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants