react-native-google-mobile-ads error RewardedAd.show() The requested RewardedAd has not loaded and could not be shown

170 Views Asked by At

I am getting this error RewardedAd.show() The requested RewardedAd has not loaded and could not be shown, I have called rewarded.show() on a button press, its working fine on iOS but getting this error on android, also it was working fine like a week ago.

the library I am using : "react-native-google-mobile-ads": "^12.1.2",

  useEffect(() => {
    const unsubscribeLoaded = rewarded.addAdEventListener(
      RewardedAdEventType.LOADED,
      () => {
        setLoaded(true);
        console.log('Rewarded Ad Loaded');
      },
    );
    const unsubscribeEarned = rewarded.addAdEventListener(
      RewardedAdEventType.EARNED_REWARD,

       () => {
         console.log('User earned reward of ', reward);

      },
    );

    rewarded.load();

    return () => {
      unsubscribeLoaded();
      unsubscribeEarned();
    };
  }, []);

I have called a function on a button press

const showAd = async () => {

setReloadAd(false);
setTimeout(() => {
  rewarded.show();
}, 3000);

};

wether I use the setTimeout or not, I can't get it to work on Android.

although Interstitial ads are working perfectly

0

There are 0 best solutions below