Interstitial Ad doesn't cover all screen for some device

50 Views Asked by At

In my flutter app Interstitial Ad doesn't cover all screen , I test my app and blank app same issuse the top of the screen not coverd by ads in same device like (Pixel 6 Pro API 34 emalutor) my flutter last version and i use google_mobile_ads: ^4.0.0 package

void _createInterstitialAd() {
    InterstitialAd.load(
        adUnitId:'ca-app-pub-3940256099942544/1033173712',
          
        request: request,
        adLoadCallback: InterstitialAdLoadCallback(
          onAdLoaded: (InterstitialAd ad) {
            print('$ad loaded');
            _interstitialAd = ad;
            _numInterstitialLoadAttempts = 0;
            _interstitialAd!.setImmersiveMode(true);
          },
          onAdFailedToLoad: (LoadAdError error) {
            print('InterstitialAd failed to load: $error.');
            _numInterstitialLoadAttempts += 1;
            _interstitialAd = null;
            if (_numInterstitialLoadAttempts < 3) {
              _createInterstitialAd();
            }
          },
        ));
  }



void _showInterstitialAd() {
    if (_interstitialAd == null) {
      print('Warning: attempt to show interstitial before loaded.');
      return;
    }
    _interstitialAd!.fullScreenContentCallback = FullScreenContentCallback(
      onAdShowedFullScreenContent: (InterstitialAd ad) =>
          print('ad onAdShowedFullScreenContent.'),
      onAdDismissedFullScreenContent: (InterstitialAd ad) {
        print('$ad onAdDismissedFullScreenContent.');
        ad.dispose();
        _createInterstitialAd();
      },
      onAdFailedToShowFullScreenContent: (InterstitialAd ad, AdError error) {
        print('$ad onAdFailedToShowFullScreenContent: $error');
        ad.dispose();
        _createInterstitialAd();
      },
    );
    _interstitialAd!.show();
    _interstitialAd = null;
  }

 @override
  void initState() {
   _createInterstitialAd();
   // checkconsent();
    super.initState();
  }

enter image description here

0

There are 0 best solutions below