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:
Name | Type | Default | Description |
---|---|---|---|
showOnColdStart | boolean | false | Whether to show ad on app coldstart. |
showOnAppForeground | boolean | true | Whether to show ad on app becomes foreground. |
loadOnDismissed | boolean | true | Whether to load new ad when ad is dismissed. |
requestOptions | RequestOptions | {} | Optional RequestOptions used to load the ad. |