startAppOpenAds
import { startAppOpenAds, type AppOpenAdsOptions } from 'nitro-ui-admob'
function startAppOpenAds(options: AppOpenAdsOptions): () => void
Shows an app open ad each time the app returns from the background, following Google's guidance: the ad is preloaded and replaced before it expires, nothing shows on a cold start or over another full-screen ad, and minimumInterval caps how often ads show.
Returns a function that stops showing and loading app open ads. Guide: app open ads.
AppOpenAdsOptions
| Field | Type | Description |
|---|---|---|
adUnitId | string | Required. The AdMob app open ad unit ID. |
requestOptions | AdmobRequestOptions | Targeting for the ad requests. |
minimumInterval | number | The minimum time between two app open ads, in milliseconds. Defaults to 0. |
onWillShow | (ad: AppOpenAd) => void | Called with each ad right before it is shown, for example to set its callbacks. |
onLoadError | (error: unknown) => void | Called with each failed load. Loads are retried with backoff. |
const stop = startAppOpenAds({
adUnitId: Admob.testAdUnitId('appOpen'),
minimumInterval: 30 * 60 * 1000,
})