javascript - Error: firebase.admob() InterstitialAd.show() The requested InterstitialAd has not loaded and could not be shown -

I'm using react-native-firebaseadmob to use Adbmod in react native, and when I try to use Inter

I'm using react-native-firebase / admob to use Adbmod in react native, and when I try to use Interstitial Ads on my first click it opens the ad, but from then on it returns this error:

Error: firebase.admob () InterstitialAd.show () The requested InterstitialAd has not loaded and could not be shown.

The Code is the same as the documentation and can be found here:

I'm using react-native-firebase / admob to use Adbmod in react native, and when I try to use Interstitial Ads on my first click it opens the ad, but from then on it returns this error:

Error: firebase.admob () InterstitialAd.show () The requested InterstitialAd has not loaded and could not be shown.

The Code is the same as the documentation and can be found here:

https://rnfirebase.io/admob/displaying-ads#banner-ads

Share asked Jul 13, 2020 at 21:22 Paulo HenrickPaulo Henrick 691 silver badge7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

Basically you need to reload the ad after it has been viewed. So you could add an AdEventType.CLOSED listener and reload the ad there.

 useEffect(() => {
    const eventListener = interstitial.onAdEvent(type => {
      if (type === AdEventType.LOADED) {
        setLoaded(true);
      }
      if (type === AdEventType.CLOSED) {
        console.log("ad closed");
        setLoaded(false);
       
        //reload ad 
        interstitial.load();
      }
    });

    // Start loading the interstitial straight away
    interstitial.load();

    // Unsubscribe from events on unmount
    return () => {
      eventListener();
    };
  }, []);

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745098234a4611113.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信