feat(anuncios): servir los anuncios reales de AdMob en produccion
Build & Deploy PluriWave / Análisis de código (push) Successful in 27s
Build & Deploy PluriWave / Build APK + AAB release (push) Successful in 3m19s

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.
This commit is contained in:
2026-10-03 08:49:22 +02:00
parent 7439789d5e
commit 8c5b29eb3d
2 changed files with 16 additions and 9 deletions
+7 -6
View File
@@ -18,12 +18,13 @@ const _interstitialAdUnitIdReal = 'ca-app-pub-6038935671414339/4189478248';
/// TESTING-PHASE SWITCH. While `true`, release builds serve Google's official /// 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 /// TEST ad units instead of the real ones, so none of the closed-testing
/// human testers can generate invalid traffic against the AdMob account /// human testers can generate invalid traffic against the AdMob account
/// (they cannot be registered as AdMob test devices). Flip to `false` for /// (they cannot be registered as AdMob test devices). Turned `false` for the
/// the production release — that is the ONLY change needed to start serving /// first production release (1.3.3+166): release builds now serve the real
/// real ads. This does NOT affect the AdMob application id in /// units. Debug and profile builds keep the test ids regardless. This does
/// `AndroidManifest.xml`, which stays real in every build (it only /// NOT affect the AdMob application id in `AndroidManifest.xml`, which stays
/// initializes the SDK and carries none of the click risk). /// real in every build (it only initializes the SDK and carries none of the
const usarAnunciosDePruebaEnRelease = true; /// click risk).
const usarAnunciosDePruebaEnRelease = false;
/// Real id in release builds only, and only once [usarAnunciosDePruebaEnRelease] /// Real id in release builds only, and only once [usarAnunciosDePruebaEnRelease]
/// is flipped to `false`; test id everywhere else (debug/profile, including /// is flipped to `false`; test id everywhere else (debug/profile, including
+9 -3
View File
@@ -162,9 +162,15 @@ void main() {
}); });
group('usarAnunciosDePruebaEnRelease — interruptor de fase de pruebas', () { group('usarAnunciosDePruebaEnRelease — interruptor de fase de pruebas', () {
test('mientras esta en true, bannerAdUnitId e interstitialAdUnitId son los ' test('en produccion el interruptor esta apagado: las builds release '
'ids oficiales de prueba de Google', () { 'sirven los anuncios reales', () {
expect(usarAnunciosDePruebaEnRelease, isTrue); // 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(bannerAdUnitId, equals('ca-app-pub-3940256099942544/6300978111'));
expect( expect(
interstitialAdUnitId, interstitialAdUnitId,