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?