1

I'm developing a Cordova app using HTML, CSS, and JavaScript, and I'm trying to integrate AdMob ads using the admob-plus-cordova plugin. However, the ads are not displaying on my device.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AdMob Plus Example</title>
</head>

<body>
    <h1>Hello, AdMob!</h1>

    <script type="text/javascript">

        let banner

        document.addEventListener('deviceready', async () => {
            banner = new admob.BannerAd({
                adUnitId: 'ca-app-pub-3940256099942544/6300978111',
            })

            banner.on('impression', async (evt) => {
                await banner.hide()
            })

            await banner.show()
        }, false)

    </script>
</body>

</html>

Despite these efforts, the ads still aren't displaying. Any insights or suggestions on what might be going wrong would be greatly appreciated!

1 Answer 1

0

It looks like you might have skipped a step, which is to start the plugin, as per the documentation. Try

 document.addEventListener('deviceready', async () => {
      await admob.start();
      ...
 });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.