Admob Interstitials not working in IOs (standalone ipa build)

#1

I’ve added admob ads to my app, some interstitial and banners.

Interstitials do not show up in IOs, when building a standalone .ipa, but a banner in the same .ipa works.

Interstitials work also running in expo over IOs and Android, and they also work running in android from an apk too.

Code:

// Adds
import {
  AdMobBanner,
  AdMobInterstitial,
  PublisherBanner,
  AdMobRewarded
} from 'expo';

...

export default class App extends React.Component {
  state = {
    isLoadingComplete: false,
  };

  render() {
    if (!this.state.isLoadingComplete && !this.props.skipLoadingScreen) {
      return (
        <AppLoading
          startAsync={this._loadResourcesAsync}
          onError={this._handleLoadingError}
          onFinish={this._handleFinishLoading}
        />
      );
    } else {
      return (
        <View style={styles.container}>
          {Platform.OS === 'ios' && <StatusBar barStyle="default" />}
          {Platform.OS === 'android' && <View style={styles.statusBarUnderlay} />}
          <Provider store={store}>
            <RootNavigation />
          </Provider>
        </View>
      );
    }
  }

  _loadResourcesAsync = async () => {
    return Promise.all([
      Asset.loadAsync([
       ....
      ]),
      Font.loadAsync({
            ...
      }),
    ]);
  };

  _handleLoadingError = error => {
    // In this case, you might want to report the error to your error
    // reporting service, for example Sentry
    console.warn(error);
  };

  _handleFinishLoading = () => {
    this.setState({ isLoadingComplete: true });
  };

  showInterstitial() {
      console.log("[App.showInterstitial]> Showing adds..")
      AdMobInterstitial.requestAd(() => AdMobInterstitial.showAd());
  }

  componentDidMount() {
      console.log("[App._handleFinishLoading]> Setting up adds..")
      AdMobInterstitial.setAdUnitID("ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxx");
      AdMobInterstitial.addEventListener("interstitialDidLoad", () =>
        console.log("interstitialDidLoad")
      );
      AdMobInterstitial.addEventListener("interstitialDidFailToLoad", (event) =>
        console.log(`interstitialDidFailToLoad: ${JSON.stringify(event)}`)
      );
      AdMobInterstitial.addEventListener("interstitialDidOpen", () =>
        console.log("interstitialDidOpen")
      );
      AdMobInterstitial.addEventListener("interstitialDidClose", () =>
        console.log("interstitialDidClose")
      );
      AdMobInterstitial.addEventListener("interstitialWillLeaveApplication", () =>
        console.log("interstitialWillLeaveApplication")
      );

      this.showInterstitial();// Show adds
    }

  componentWillUnmount() {
      AdMobInterstitial.removeAllListeners();
  }

}

Has anybody experimented the same issue?

#2

Hi @marianobrc - it’s hard to tell exactly what’s going on here. Could you maybe create a snack that fully reproduces this issue?

Also, it’s possible that sometimes admob simply doesn’t have an ad available to show. Do you see anything logged in your device console when you try to show an interstitial ad?

#3

Hi @esamelson, thanks for your answer.

I’ve catched and logged all the events related to the interstitials and all works good when running the app in expo, but the problem is when I genereate an .ipa and I run the app in a real Iphone. Then as is a production build I can’t see the logs anymore in XDE.

I’ll try to reproduce it in a snack.

#4

I’ve added a snack

https://snack.expo.io/@marianobrc/admob-interstitial

It seems to be working now, in this minimal example and in my app too, without doing anything.

So I think it’s just that AdMob takes some time to start sending ads. I’ve read that google tries to gather some information about the app user, like the location, age… before start sending ads, then the first times he uses the apps maybe the ads are not retrieved.

closed #5

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.