From 8c5b29eb3da20013355ba626948d00936d514cce Mon Sep 17 00:00:00 2001 From: freetlab Date: Sat, 3 Oct 2026 08:49:22 +0200 Subject: [PATCH] feat(anuncios): servir los anuncios reales de AdMob en produccion La prueba cerrada forzaba los ids de prueba de Google tambien en release, para que los testers no generaran trafico invalido contra la cuenta de AdMob. Para la primera version de produccion el interruptor pasa a false: las builds release sirven el banner y el intersticial reales. Debug, profile y las pruebas siguen usando siempre los ids de prueba, asi que desarrollar en un movil propio no toca la cuenta real. El test guardian fija ahora el valor de produccion, para que nadie vuelva a encenderlo por descuido y publique banners "Test Ad" que no ingresan nada. --- lib/servicios/servicio_anuncios.dart | 13 +++++++------ test/servicios/servicio_anuncios_test.dart | 12 +++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/servicios/servicio_anuncios.dart b/lib/servicios/servicio_anuncios.dart index 669400b..c6f1067 100644 --- a/lib/servicios/servicio_anuncios.dart +++ b/lib/servicios/servicio_anuncios.dart @@ -18,12 +18,13 @@ const _interstitialAdUnitIdReal = 'ca-app-pub-6038935671414339/4189478248'; /// TESTING-PHASE SWITCH. While `true`, release builds serve Google's official /// TEST ad units instead of the real ones, so none of the closed-testing /// human testers can generate invalid traffic against the AdMob account -/// (they cannot be registered as AdMob test devices). Flip to `false` for -/// the production release — that is the ONLY change needed to start serving -/// real ads. This does NOT affect the AdMob application id in -/// `AndroidManifest.xml`, which stays real in every build (it only -/// initializes the SDK and carries none of the click risk). -const usarAnunciosDePruebaEnRelease = true; +/// (they cannot be registered as AdMob test devices). Turned `false` for the +/// first production release (1.3.3+166): release builds now serve the real +/// units. Debug and profile builds keep the test ids regardless. This does +/// NOT affect the AdMob application id in `AndroidManifest.xml`, which stays +/// real in every build (it only initializes the SDK and carries none of the +/// click risk). +const usarAnunciosDePruebaEnRelease = false; /// Real id in release builds only, and only once [usarAnunciosDePruebaEnRelease] /// is flipped to `false`; test id everywhere else (debug/profile, including diff --git a/test/servicios/servicio_anuncios_test.dart b/test/servicios/servicio_anuncios_test.dart index 0c21790..86c0f09 100644 --- a/test/servicios/servicio_anuncios_test.dart +++ b/test/servicios/servicio_anuncios_test.dart @@ -162,9 +162,15 @@ void main() { }); group('usarAnunciosDePruebaEnRelease — interruptor de fase de pruebas', () { - test('mientras esta en true, bannerAdUnitId e interstitialAdUnitId son los ' - 'ids oficiales de prueba de Google', () { - expect(usarAnunciosDePruebaEnRelease, isTrue); + test('en produccion el interruptor esta apagado: las builds release ' + 'sirven los anuncios reales', () { + // Flipped for the first production release (1.3.3+166). Re-enabling it + // would silently ship Google's "Test Ad" banners and earn nothing. + expect(usarAnunciosDePruebaEnRelease, isFalse); + }); + + test('fuera de release (debug, profile y pruebas) se usan siempre los ids ' + 'oficiales de prueba de Google', () { expect(bannerAdUnitId, equals('ca-app-pub-3940256099942544/6300978111')); expect( interstitialAdUnitId,