thecodrr / react-native-google-admob

The most definitive Google Admob library for React Native.
BSD 2-Clause "Simplified" License
17 stars 4 forks source link

Ad not showing in iOS #12

Open rahulje9 opened 3 years ago

rahulje9 commented 3 years ago

Hi,

I have followed all the steps and set up everything but no matter what ad is not showing on the physical iOS device. I wasn't getting the ad in the simulator too, but for the past few days, I'm seeing ads in the simulator. everything is working fine on the android side. I'm calling a function to show an ad and the code for it is as follows.

  componentDidMount() {
    AdMobRewarded.setAdUnitID(this.rewardID);
    AdMobInterstitial.setTestDevices([AdMobInterstitial.simulatorId]);

    AdMobRewarded.addEventListener('rewarded', (reward) => {

    /*this function will reward the user for seeing ads*/

      this.addTickets('ads');

    });
    AdMobRewarded.addEventListener('adLoaded', () =>
      console.log('AdMobRewarded => adLoaded'),
    );
    AdMobRewarded.addEventListener('adFailedToLoad', (error) =>
      console.warn(error),
    );
    AdMobRewarded.addEventListener('adOpened', () =>
      console.log('AdMobRewarded => adOpened'),
    );
    AdMobRewarded.addEventListener('videoStarted', () =>
      console.log('AdMobRewarded => videoStarted'),
    );
    AdMobRewarded.addEventListener('adClosed', () => {
      console.log('AdMobRewarded => adClosed');
      AdMobRewarded.requestAd().catch((error) => {});
    });
    AdMobRewarded.addEventListener('adLeftApplication', () =>
      console.log('AdMobRewarded => adLeftApplication'),
    );
    AdMobRewarded.requestAd().catch((error) => {});
}
    AdMobRewarded.showAd().catch((error) => {
      Toast.show('Ad is not ready, Please try after sometime.');
    });

Package versions

    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-google-admob": "latest version",

do I need to start a campaign in Google Ad-Mob for ads to show on the iOS device? it would be very grateful if someone helps me with this

I tried this with both react-native-google-admob and react-native-admob