diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 70bfd26..12793f3 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -138,16 +138,14 @@ android:name="com.google.android.gms.car.application" android:resource="@xml/automotive_app_desc" /> - + + android:value="ca-app-pub-6038935671414339~4085536467" /> diff --git a/lib/servicios/servicio_anuncios.dart b/lib/servicios/servicio_anuncios.dart index fea7027..b65b47e 100644 --- a/lib/servicios/servicio_anuncios.dart +++ b/lib/servicios/servicio_anuncios.dart @@ -1,15 +1,30 @@ import 'dart:async'; -import 'package:flutter/foundation.dart' show debugPrint; +import 'package:flutter/foundation.dart' show debugPrint, kReleaseMode; import 'package:google_mobile_ads/google_mobile_ads.dart'; -/// TODO(ads): official Google TEST ad unit ids — AdMob has not provisioned -/// real ones yet (design.md Open Questions). Swap these for the real banner -/// / interstitial unit ids once available; never ship the test ids to -/// production. +/// Official Google TEST ad unit ids. ALWAYS used outside release builds — +/// tapping your own real ad unit during development/testing is invalid +/// traffic and AdMob suspends accounts for it, so this is not optional. const bannerAdUnitIdPrueba = 'ca-app-pub-3940256099942544/6300978111'; const interstitialAdUnitIdPrueba = 'ca-app-pub-3940256099942544/1033173712'; +/// Real banner unit id, provisioned in the AdMob console (iap-freemium-unlock). +const _bannerAdUnitIdReal = 'ca-app-pub-6038935671414339/5658618378'; + +/// Real interstitial unit id, provisioned in the AdMob console (iap-freemium-unlock). +const _interstitialAdUnitIdReal = 'ca-app-pub-6038935671414339/4189478248'; + +/// Real id in release builds only; test id everywhere else (debug/profile, +/// including internal-testing-track builds run via `flutter run --release` +/// on a personal device — see the "never tap your own ads" note above). +const bannerAdUnitId = kReleaseMode + ? _bannerAdUnitIdReal + : bannerAdUnitIdPrueba; +const interstitialAdUnitId = kReleaseMode + ? _interstitialAdUnitIdReal + : interstitialAdUnitIdPrueba; + /// Ads port + AdMob adapter (Design "Interfaces / Contracts", ADR-6): owns /// the entitlement gate for both surfaces, the interstitial's session /// frequency cap, and is the ONLY `google_mobile_ads` call site besides @@ -80,7 +95,7 @@ class ServicioAnuncios { try { final cargaCompleter = Completer(); await InterstitialAd.load( - adUnitId: interstitialAdUnitIdPrueba, + adUnitId: interstitialAdUnitId, request: const AdRequest(), adLoadCallback: InterstitialAdLoadCallback( onAdLoaded: (ad) { diff --git a/lib/widgets/banner_anuncio_superior.dart b/lib/widgets/banner_anuncio_superior.dart index 5abf060..142b231 100644 --- a/lib/widgets/banner_anuncio_superior.dart +++ b/lib/widgets/banner_anuncio_superior.dart @@ -40,7 +40,7 @@ class _BannerAnuncioSuperiorState extends State { // load failure takes in production. Never throws out of this method. final anuncio = BannerAd( size: AdSize.banner, - adUnitId: bannerAdUnitIdPrueba, + adUnitId: bannerAdUnitId, request: const AdRequest(), listener: BannerAdListener( onAdLoaded: (ad) {