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

Reward Ad Loading Fails After Upgrading from 3.9.2 to 4.1.2 #287

Open
MasatomoFukuda opened this issue Dec 18, 2024 · 0 comments
Open

Reward Ad Loading Fails After Upgrading from 3.9.2 to 4.1.2 #287

MasatomoFukuda opened this issue Dec 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@MasatomoFukuda
Copy link

MAX Plugin Version

4.1.2

Flutter Version

3.24.3

Device/Platform Info

iOS 17.6.1 and 18.2

Current Behavior

After upgrading the SDK version from 3.9.2 to 4.1.2, the loading of rewarded video ads fails under specific conditions.
This issue does not occur in versions 3.10.1 or earlier.

Expected Behavior

  1. Launch the app.
  2. Play a rewarded ad and terminate the app midway (task kill).
  3. Restart the app and press the rewarded ad load button.
  4. The ad plays successfully.

How to Reproduce

  1. Launch the app.
  2. Play a rewarded ad and terminate the app midway (task kill).
  3. Restart the app and press the rewarded ad load button.
  4. The ad fails to load (retrying does not resolve the issue).

Reproducible in the demo app?

Yes

Additional Info

I tried to check the error code, but I couldn't confirm it because the onAdLoadFailedCallback was not triggered.

/// Rewarded Ad Listeners
AppLovinMAX.setRewardedAdListener(
  RewardedAdListener(
    onAdLoadedCallback: (ad) {
      _adLoadState = AdLoadState.loaded;

      _logStatus('Rewarded ad loaded from ${ad.networkName}');

      _rewardedAdRetryAttempt = 0;

      _eventController.state = const RewardedAdEvent.onAdLoadedCallback();
      notifyListeners();
    },
    onAdLoadFailedCallback: (adUnitId, error) {
      _adLoadState = AdLoadState.notLoaded;

      _rewardedAdRetryAttempt = _rewardedAdRetryAttempt + 1;

      var retryDelay = pow(2, min(6, _rewardedAdRetryAttempt)).toInt();
      _logStatus(
        '''Rewarded ad failed to load with code ${error.code} - retrying in ${retryDelay}s''',
      );

      // force crash <- not called when load failed
      FirebaseCrashlytics.instance.crash();

      Future.delayed(Duration(milliseconds: retryDelay * 1000), () {
        AppLovinMAX.loadRewardedAd(_unitId);
      });
      _eventController.state =
          const RewardedAdEvent.onAdLoadFailedCallback();
      notifyListeners();
    },
...
@MasatomoFukuda MasatomoFukuda added the bug Something isn't working label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant