Fixing ‘Ad is already loaded’ error when using AdMobRewarded or AdMobInterstitial in React Native.

Tiempo de lectura: < 1 minuto

Reading time: < 1 minute

If you see the message ‘Ad is already loaded’ when running the application on our device or emulator, it means there are issues loading the ad we requested from AdMob.

This occurs because the ad is requested once, and when requested a second time, it fails.

const reward = async () => {
    await AdMobRewarded.setAdUnitID('ad_unit_id');
    try {
        await AdMobRewarded.requestAdAsync();
        await AdMobRewarded.showAdAsync();
    } catch (error) {
        console.log(error)
    }
}

To solve this issue, we use the following code, which resynchronizes the ad to avoid the problem:

setTimeout(() => {
        AdMobInterstitial.dismissAdAsync();
    }, 1500);

or

setTimeout(() => {
        AdMobRewarded.dismissAdAsync();
    }, 1500);

The code will then look as follows:

const reward = async () => {
    await AdMobRewarded.setAdUnitID('ad_unit_id');
    try {
        await AdMobRewarded.requestAdAsync();
        await AdMobRewarded.showAdAsync();
    } catch (error) {
        console.log(error)
    }
    setTimeout(() => {
        AdMobRewarded.dismissAdAsync();
    }, 1500);
}

By doing this, the error message will no longer appear, and the desired ad will be displayed.

Leave a Comment