-
I want to show ads when the user opens the app ads.
-
the error [Unhandled promise rejection: Error: Ad is not ready.] after await [Unhandled promise rejection: Error: ERROR_CODE_INVALID_REQUEST]
-
my code in hooks
import { AdMobBanner, AdMobInterstitial, PublisherBanner, AdMobRewarded, setTestDeviceIDAsync, } from 'expo-ads-admob'; //test device ID setTestDeviceIDAsync('EMULATOR'); export default function Start() { // Display an interstitial on start (async () => { try { await AdMobInterstitial.setAdUnitID('ca-app-pub-3498930144178074/7650666213'); await AdMobInterstitial.requestAdAsync({ servePersonalizedAds: true }); await AdMobInterstitial.showAdAsync(); } catch { (e) => console.log(e) } }) // Display an interstitial on start const initRewardAds = async () => { await AdMobInterstitial.setAdUnitID('ca-app-pub-....'); await AdMobInterstitial.requestAdAsync({ servePersonalizedAds: true }); await AdMobInterstitial.showAdAsync(); } initRewardAds();
}