Show Admob ads on Capacitor

I’m moving an app to capacitor and I have a problem. The app works correctly, and I don’t have any errors, but for some reason the advertising banner is not visible, do you know why? I have checked the App and Ad code and they are correct, and in the one in production it works correctly. Thanks.

index.html code:

    <title>App</title>

    <!-- Enlace a Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Script para inicializar AdMob -->
    <script>
    document.addEventListener('deviceready', function() {
        if (window.AdMob) {
            const admobId = {
                banner: 'ca-app-pub-000000000/00000000' 
            };

            // Inicializar AdMob
            AdMob.initialize();

            // Crear el banner en un contenedor específico
            AdMob.createBannerView({
                adId: admobId.banner,
                isTesting: false, // Cambia a false en producción
                autoShow: true,
                adContainer: document.getElementById('ad-banner-top-container') // Especifica el contenedor donde se mostrará el banner
            }).then(() => {
                console.log('Banner ad created successfully');
            }).catch(err => {
                console.error('Failed to create banner ad', err);
            });
        } else {
            console.log('AdMob plugin not ready');
        }
    }, false);
</script>
</head>
<body>
    <div class="container mt-5">
        

        <div class="card">
            <div class="card-body">
                <h5 class="card-title">Enviar WhatsApp</h5>
                <form id="whatsappForm">
                    <div class="mb-3">
                        <label for="languageSelector" class="form-label">Seleccione idioma</label>
                        <select class="form-select" id="languageSelector" name="languageSelector">
                            <option value="es">Español</option>
                            <option value="en">Inglés</option>
                            <option value="fr">Francés</option>
                            <option value="zh">Chino</option>
                            <option value="ar">Árabe</option>
                        </select>
                    </div>
                    <div class="mb-3">
                        <label for="origenSeleccion" class="form-label">Seleccione país</label>
                        <select class="form-select" id="origenSeleccion" name="origenSeleccion">
                            <!-- Los nombres de los países se llenarán dinámicamente -->
                        </select>
                    </div>
                    <div class="mb-3">
                        <label for="telefono" class="form-label">Número de teléfono</label>
                        <input type="text" class="form-control" id="telefono" placeholder="Ingrese su número de teléfono" required>
                    </div>
                    
                    <!-- Contenedor para el anuncio de banner superior -->
                    <div id="ad-banner-top-container" style="margin-bottom: 20px;"></div>

                    <button type="submit" class="btn btn-success">Enviar WhatsApp</button>

                    <!-- Contenedor para el anuncio de banner inferior -->
                    <div id="ad-banner-bottom-container" style="margin-bottom: 20px;"></div>
                </form>
            </div>
        </div>
    </div>

    <!-- Enlace a Bootstrap JS (Opcional, para componentes interactivos) -->
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

capacitor.config.json code:

{
  "appId": "com.example.es",
  "appName": "Example",
  "webDir": "dist",
  "plugins": {
    "SplashScreen": {
      "launchShowDuration": 0
    },
    "AdMob": {
            "appIdAndroid": "ca-app-pub-00000000~000000"
    },

  }
}

package.json code

{
  "name": "Hello Ap",
  "version": "1.0.0",
  "description": "Hello",
  "main": "index.js",
  "keywords": [
    "capacitor",
    "mobile"
  ],
  "scripts": {
    "start": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@capacitor-community/admob": "^5.0.0",
    "@capacitor/android": "^5.0.0",
    "@capacitor/core": "^5.0.0",
    "@capacitor/ios": "^5.0.0",
    "@capacitor/splash-screen": "^5.0.0"
  },
  "devDependencies": {
    "@capacitor/cli": "^5.0.0",
    "typescript": "^5.5.4",
    "vite": "latest"
  },
  "author": "CompanySLU",
  "license": "ISC"
}

I finally solved it by changing the settings in MainActivity.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật