[googleads-mobile-flutter] [android] [App Open Ad] AdError code 3, message the ad can not be shown when app is not in foreground

173 views
Skip to first unread message

peter

unread,
May 9, 2024, 11:37:56 AM5/9/24
to Google Mobile Ads SDK Developers
step to reproduce, just as the sample code, instead to report error other than ignore


1. on app init event, register AppLifecycleReactor

```dart

// just as the sample code

  @override
  void initState() {
    super.initState();
    AppOpenAdManager appOpenAdManager = AppOpenAdManager()..loadAd();
    _appLifecycleReactor =
        AppLifecycleReactor(appOpenAdManager: appOpenAdManager);
    _appLifecycleReactor.listenToAppStateChanges();
  }
```

2. on AppLifecycleReactor foreground event, call showAdIfAvailable()

```dart

// just as the sample code

  void listenToAppStateChanges() {
    AppStateEventNotifier.startListening();
    AppStateEventNotifier.appStateStream
        .forEach((state) => _onAppStateChanged(state));
  }

  void _onAppStateChanged(AppState appState) {
    print('New AppState state: $appState');
    if (appState == AppState.foreground) {
      appOpenAdManager.showAdIfAvailable();
    }
  }
```

3. report error using crashlytics

```dart

// just as the sample code

      onAdFailedToShowFullScreenContent: (ad, error) {

        debugPrint('$ad onAdFailedToShowFullScreenContent: $error');
        _isShowingAd = false;
        ad.dispose();
        _appOpenAd = null;

// instead report error

FirebaseCrashlytics.instance.recordError( error, stackTrace, information: ['$ad'], );
      },
```

peter

unread,
May 9, 2024, 2:43:19 PM5/9/24
to Google Mobile Ads SDK Developers
orginal issues:

the error rate is 6-10% in production,
it ALSO happens non-production, just the (show ad call) number is large then easier to be noticed in production

thanks

Mobile Ads SDK Forum Advisor

unread,
May 9, 2024, 11:53:01 PM5/9/24
to peterw...@gmail.com, google-adm...@googlegroups.com
Hi, 

Thank you for contacting us.

I have tested googleads-mobile-flutter samples with our test ID's for multiple times and couldn't reproduce the issue, Kindly provide your app ID and ad unit ID for further investigation on this issue.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02tIvqP:ref" (ADR-00234353)

Thanks,
 
Google Logo Mobile Ads SDK Team


peter

unread,
May 10, 2024, 12:16:54 AM5/10/24
to Google Mobile Ads SDK Developers
send to where? how can you investigate?

eg: app open ad, last day I have 640 impressions & last 24 hours 36 errors
note that the day range is diff, but both 24 hours

Mobile Ads SDK Forum Advisor

unread,
May 10, 2024, 6:34:43 AM5/10/24
to peterw...@gmail.com, google-adm...@googlegroups.com

Hi,

I see that same concern on another thread with the subject '[google-admob-ads-sdk] Received error HTTP response code: 403', and we have already responded there for this issue. To avoid multiple threads on the same issue, please take a look at that thread and continue the discussion on the same for further updates on the issue.

peter

unread,
May 10, 2024, 12:19:16 PM5/10/24
to Google Mobile Ads SDK Developers
this is "show error", and  that is "load error"
Reply all
Reply to author
Forward
0 new messages