Skip to main content

AppOpenAdProvider

The AppOpenAdProvider provides context related to AppOpenAd to be used for the useAppOpenAd hook.

You should wrap your app components with AppOpenAdProvider to use useAppOpenAd hook in your app.

import { AppOpenAdProvider, TestIds } from '@react-native-admob/admob';

export default function App() {
return (
<AppOpenAdProvider
unitId={isPaid ? null : TestIds.APP_OPEN}
options={{ showOnColdStart: true }}
>
{/* ... */}
</AppOpenAdProvider>
);
}

For detailed usage, see useAppOpenAd.

Props

unitId

Your App Open Ad's ad Unit ID

Type
string

options

Options for your App Open Ad. Available values are listed below:

Type
object

Properties:

NameTypeDefaultDescription
showOnColdStartbooleanfalseWhether to show ad on app coldstart.
showOnAppForegroundbooleantrueWhether to show ad on app becomes foreground.
loadOnDismissedbooleantrueWhether to load new ad when ad is dismissed.
requestOptionsRequestOptions{}Optional RequestOptions used to load the ad.