Interstitial.load crash and close App #5166
RayosElDev
started this conversation in
General
Replies: 2 comments 3 replies
-
Duplicate of #5093 and I have a reproduction there, hoping to give it a go tomorrow |
Beta Was this translation helpful? Give feedback.
2 replies
-
workaround
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I just follow the tutorial to add Admob in my react App.
Analytics works fine.
Admob Banner works fine
But when I just copy the example of Interstitial or Reward Ad I have a crash when I call the line interstitial.load();
the code is the same of here:
https://rnfirebase.io/admob/usage
`import React, { useEffect, useState } from 'react';
import { Button } from 'react-native';
import { InterstitialAd, AdEventType, TestIds } from '@react-native-firebase/admob';
const adUnitId = DEV ? TestIds.INTERSTITIAL : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
const interstitial = InterstitialAd.createForAdRequest(adUnitId, {
requestNonPersonalizedAdsOnly: true,
keywords: ['fashion', 'clothing'],
});
function App() {
const [loaded, setLoaded] = useState(false);
useEffect(() => {
const eventListener = interstitial.onAdEvent(type => {
if (type === AdEventType.LOADED) {
setLoaded(true);
}
});
}, []);
// No advert ready to show yet
if (!loaded) {
return null;
}
return (
<Button
title="Show Interstitial"
onPress={() => {
interstitial.show();
}}
/>
);
}`
Beta Was this translation helpful? Give feedback.
All reactions