'cordova admob plus not showing ads

I am trying to show a rewarded ad (with admob) plus when my function is called. I tried with Interstitial too but nothing shown. I am using google test ads and ID

let rewarded;
document.addEventListener('deviceready', async () => {
    await admob.start().then(() => {
        console.log('AdMob started.');
    }).catch(e => console.log(e));

    rewarded = new admob.RewardedAd({
        adUnitId: 'ca-app-pub-3940256099942544/5224354917'
    });
}, false)


function Reward() {
    rewarded.on('load', (evt) => {
        await rewarded.load();
    })

    rewarded.load()
    rewarded.show()
}

I have tried many modifications but still no ad is displayed. Maybe the problem is that I need something in the config.xml file Please help



Solution 1:[1]

try var rewarded; instead of

let rewarded;

------------------------ or ------------------------

I suggest

admob.rewarded = new admob.RewardedAd (...)

function Reward() {
  admob.rewarded.on('load', (evt) => {
    await admob.rewarded.load();
  })

  admob.rewarded.load()
  admob.rewarded.show()
} 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 hesam rajaei