Skip to content

Log why the consent flow hid the ad banner - #516

Merged
andiwand merged 1 commit into
mainfrom
log-consent-failures
Jul 26, 2026
Merged

Log why the consent flow hid the ad banner#516
andiwand merged 1 commit into
mainfrom
log-consent-failures

Conversation

@andiwand

@andiwand andiwand commented Jul 26, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Why

While checking that the ad banner still works after the package rename, the banner failed to appear and there was no way to tell why from the app's own logs.

Both UMP callbacks in AdManager discard their FormError and just call hideGoogleAds(), so "consent failed" and "ads were never requested" look identical from outside. The UMP SDK only logs an unspecific Error making request. of its own. Diagnosing it needed a temporary patch, a rebuild and a reinstall.

What

Report the error code and message through CrashManager in both callbacks, plus canRequestAds() for the case where the form itself succeeded but consent was withheld. A small describe(FormError) helper keeps the two call sites readable.

Both callbacks only run while ads are enabled, which is also the only path that assigns crashManager, so this adds no new null path. CrashManager is logcat-only (tag ODR) since the Firebase integration was removed, so nothing leaves the device.

Testing

Verified on a physical Pixel 9 Pro running the Lite debug flavor.

The banner itself works. Consent form loads, canRequestAds=true, onAdLoaded fires and a real ad renders in ad_container. So the rename to app.opendocument.droid did not break AdMob — the identity is tied to applicationId, which is unchanged.

Happy path stays quiet. No new lines under the ODR tag on a successful load.

Failure path produces the intended line. Reproduced by clearing the cached UMP consent state and launching with the screen off, so the device dozes and the request times out:

D/ODR (21897): consent info update failed: 4/The server timed out.

That is the whole point of the change — previously this same run logged nothing at all from the app, and the banner just silently stayed hidden.

spotlessCheck and assembleLiteDebug pass.

Worth knowing for anyone testing this: once consent info is cached, requestConsentInfoUpdate succeeds from cache even with no network, so the error path cannot be reproduced without clearing shared_prefs/__GOOGLE_FUNDING_CHOICE_SDK_INTERNAL__.xml first.

Both UMP callbacks discarded their FormError and just called
hideGoogleAds(), so a banner that never appears looks identical to one
that was never requested. The ump sdk itself only logs an unspecific
"Error making request.", which leaves nothing to go on.

Report the error code and message through CrashManager instead, plus
canRequestAds() for the case where the form succeeded but consent was
withheld. Both callbacks only run while ads are enabled, which is also
the only path that assigns crashManager, so there is no new null path.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DZqXBhXZsAp84ABwR5f3ff
@andiwand
andiwand merged commit b72dbb6 into main Jul 26, 2026
6 of 7 checks passed
@andiwand
andiwand deleted the log-consent-failures branch July 26, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant