Expand description
Google AdMob ads as Bevy resources + messages.
Flow:
- Insert
AdmobConfigwith your per-format ad unit ids (orAdmobConfig::test_adsto use Google’s official sample units). The plugin calls into the backend once to start the Mobile Ads SDK. - Wait until
AdmobState::can_request_adsis true, presentingRequestConsentfirst when consent is required. - Send
LoadAdto preload a full-screen format; readAdInventory—is_loaded(format)— to know when it’s ready to present. - Send
ShowAdto present it, orShowBanner/HideBannerfor the banner. - React to
AdLoaded/AdLoadFailed/AdShown/AdDismissed/AdShowFailed/RewardEarned/AdClicked.
Consent: read AdmobState::consent; send RequestConsent to present the
initial UMP form when required. If the PrivacyOptionsRequirement
resource is PrivacyOptionsRequirement::Required, keep a visible action
that sends PresentPrivacyOptions so the user can revisit their choices.
AdMob requires a valid consent state before serving personalized ads in
regulated regions.
§Desktop fake (non-iOS)
On cargo run off-device the bridge is a deterministic in-memory fake so the
full ad UX is exercisable with no SDK. It’s env-tunable:
BEVY_ADMOB_FAKE_NO_FILL=interstitial,rewarded— those formats fail to load.BEVY_ADMOB_FAKE_SHOW_FAIL=interstitial— those formats fail to present.BEVY_ADMOB_FAKE_REWARD_AMOUNT=10/BEVY_ADMOB_FAKE_REWARD_TYPE=coins— reward granted by rewarded formats (default1/Reward).BEVY_ADMOB_FAKE_CONSENT=required— consent startsRequiredinstead ofObtained; aRequestConsentthen resolves it toObtained.BEVY_ADMOB_FAKE_CAN_REQUEST_ADS=true— override authoritative UMP ad readiness independently of its coarse consent status.BEVY_ADMOB_FAKE_CONSENT_UPDATE=failed|fail_once— surface a persistent or one-shotConsentInfoUpdateFailed.BEVY_ADMOB_FAKE_PRIVACY_OPTIONS=required— the privacy-options entry point is required for the session.
Structs§
- AdClicked
- The user tapped the ad.
- AdDismissed
- A full-screen ad was dismissed and control returned to the app.
- AdInventory
- Per-format readiness. Read
is_loaded(format)before sendingShowAd. - AdLoad
Failed - A load failed (no fill, network, or configuration).
- AdLoaded
- A load completed and a creative is ready to present.
- AdShow
Failed - Presentation failed (e.g. nothing loaded, or the OS refused).
- AdShown
- A full-screen ad began presenting (good moment to pause gameplay/audio).
- Admob
Config - Ad configuration. Insert before or after adding the plugin; the SDK starts on the first frame this resource exists.
- Admob
State - Coarse SDK + consent + banner state, for UI that needs the big picture.
- AdsPlugin
- Consent
Info Update Failed - The latest UMP consent-info update failed.
- Consent
Updated - The consent state changed; read
AdmobState::consentfor the new value. - Hide
Banner - Hide and release the banner.
- LoadAd
- Preload a full-screen ad of
formatafterAdmobState::can_request_adsis true. No-op forAdFormat::Banner(useShowBanner). - Present
Privacy Options - Present the UMP privacy-options form in response to a visible user action.
- Request
Consent - Present the UMP consent form if one is required/available.
- Reward
Earned - The user earned a reward from a rewarded / rewarded-interstitial ad. Grant it idempotently — this fires once per completed view.
- ShowAd
- Present a previously-loaded full-screen ad. If it isn’t loaded an
AdShowFailedis emitted. - Show
Banner - Show (or move) the banner after
AdmobState::can_request_adsis true. Loads and displays in one step. - UmpTest
Config - Explicit UMP test overrides. Insert before
AdsPlugininitializes.
Enums§
- AdFormat
- An AdMob ad format. The discriminants are the stable wire values shared with the Swift bridge; do not reorder.
- AdLoad
State - Per-format load state, owned by
AdInventoryand advanced by events. - Banner
Position - Where a banner is pinned on screen.
- Consent
Status - UMP (User Messaging Platform) consent state for personalized ads.
- Privacy
Options Requirement - Whether UMP requires a visible privacy-options entry point.
- UmpDebug
Geography - Test-only geography override for UMP consent flows.
Constants§
- TEST_
APP_ ID - Google’s official iOS test app id (set as
GADApplicationIdentifierinInfo.plistwhile developing). Real ad ids only serve in production.
Functions§
- test_
unit_ id - Google’s official iOS test ad unit id for
format. Always safe to request; returns fillable test creatives without risking policy strikes. https://developers.google.com/admob/ios/test-ads