-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: update installation guide * update docs * docs: add docs for cache repositories * finalize docs * update facebook mediation version * feat: TestIds * remove facebook mediation dependancy * minor improvements to example AdView * undo changes * update installation guide
- Loading branch information
1 parent
5b0e6a5
commit 0d504ad
Showing
24 changed files
with
3,907 additions
and
5,692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
id: repository-1 | ||
title: Repository | ||
sidebar_label: Repository | ||
--- | ||
Repositories can be used to preload ads in the app and show them to the user when they navigate to some part of your app. | ||
|
||
### `registerRepository` | ||
Register a repository to preload ads | ||
|
||
#### Properties | ||
|
||
| Name | Type | Required | | ||
|-------------------------------|----------------------------------------------------------------------------------------------------------------------|----------| | ||
| name | `string` | no | | ||
| adUnitId | Ad Content Ratings | yes | | ||
| numOfAds | `number` | no | | ||
| requestNonPersonalizedAdsOnly | `boolean` | no | | ||
| expirationPeriod | `number` | no | | ||
| mediationEnabled | `boolean` | no | | ||
| videoOptions | [VideoOptions](https://ammarahm-ed.github.io/react-native-admob-native-ads/docs/nativeadview/videooptions-7) | no | | ||
| mediationOptions | [MediationOptions](https://ammarahm-ed.github.io/react-native-admob-native-ads/docs/nativeadview/mediationoptions-5) | no | | ||
| targetingOptions | [TargetingOptions](https://ammarahm-ed.github.io/react-native-admob-native-ads/docs/nativeadview/targetingoptions-6) | no | | ||
| adChoicesPlacement | `"topLeft","topRight","bottomLeft","bottomRight"` | no | | ||
| mediaAspectRatio | `"any","landscape","portrait","square","unknown"` | no | | ||
|
||
### `unRegisterRepository` | ||
Unregister a repository. All preloaded ads in this repository will be destroyed. | ||
|
||
### `resetCache` | ||
Reset all ad repositories. | ||
|
||
### `hasAd` | ||
Check if there is ad in a repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
--- | ||
id: installation-3 | ||
title: Installation | ||
sidebar_label: Installation | ||
--- | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
|
||
<Tabs> | ||
<TabItem value="npm" label="npm" default> | ||
<pre> npm install react-native-admob-native-ads --save </pre> | ||
</TabItem> | ||
<TabItem value="yarn" label="yarn"> | ||
<pre> yarn add react-native-admob-native-ads </pre> | ||
</TabItem> | ||
</Tabs> | ||
|
||
Install `react-native-vector-icons` to use `StarRatingView`. | ||
|
||
<Tabs> | ||
<TabItem value="npm" label="npm" default> | ||
<pre>npm install react-native-vector-icons --save</pre> | ||
</TabItem> | ||
<TabItem value="yarn" label="yarn"> | ||
<pre>yarn add react-native-vector-icons</pre> | ||
</TabItem> | ||
</Tabs> | ||
|
||
Complete setup of [react-native-vector-icons ](https://github.com/oblador/react-native-vector-icons) for iOS & Android. | ||
|
||
|
||
## Android Setup | ||
|
||
Add your AdMob App ID to `AndroidManifest.xml`, as described in the [Google Mobile Ads SDK documentation](https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml). | ||
|
||
```xml | ||
<manifest> | ||
<application> | ||
<!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 --> | ||
<meta-data | ||
android:name="com.google.android.gms.ads.APPLICATION_ID" | ||
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/> | ||
</application> | ||
</manifest> | ||
``` | ||
|
||
## iOS Setup | ||
|
||
Follow the guide to add [Google Mobile Ads SDK](https://developers.google.com/admob/ios/quick-start#import_the_mobile_ads_sdk) to your Xcode project. | ||
|
||
1. In your `Podfile`: | ||
|
||
``` | ||
pod 'Google-Mobile-Ads-SDK' | ||
pod 'GoogleMobileAdsMediationFacebook' | ||
``` | ||
2. Update your `info.plist` file as mentioned in [Admob Documentation](https://developers.google.com/admob/ios/quick-start#update_your_infoplist) | ||
|
||
After configuring your project run: | ||
|
||
```bash | ||
pod install --repo-update | ||
``` | ||
|
||
### Requesting IDFA on iOS 14 | ||
|
||
On iOS 14 onwards, you need to request IDFA access through App Tracking Transparency Dialog to show targeted ads to the user. For that you can use [react-native-tracking-transparency](https://github.com/mrousavy/react-native-tracking-transparency). | ||
|
||
## Generate your Native Ad Ids | ||
Before you can show any ads, you will need to generate Admob Ids on your Admob account. For debugging you can use test ad ids provided by google given below: | ||
|
||
### Android | ||
|
||
| Type | ID | | ||
|-----------------------|----------------------------------------| | ||
| Native Advanced | ca-app-pub-3940256099942544/2247696110 | | ||
| Native Advanced Video | ca-app-pub-3940256099942544/1044960115 | | ||
|
||
### iOS | ||
|
||
| Type | ID | | ||
|-----------------------|----------------------------------------| | ||
| Native Advanced | ca-app-pub-3940256099942544/3986624511 | | ||
| Native Advanced Video | ca-app-pub-3940256099942544/2521693316 | | ||
|
||
## Enable Test Device | ||
A test device can be registered on App launch with `AdManager`: | ||
|
||
```jsx | ||
import {AdManager} from "react-native-admob-native-ads"; | ||
|
||
AdManager.setRequestConfiguration({ | ||
testDeviceIds:["Your test device id"]; | ||
}); | ||
``` | ||
To get your device test ids, follow the guide for [iOS](https://developers.google.com/admob/ios/test-ads#enable_test_devices) & [Android](https://developers.google.com/admob/ios/test-ads#enable_test_devices). | ||
|
||
:::caution | ||
|
||
When you newly generate your ad ids from Admob account and implement them in the app. It can take a few hours to a day for ads to show up. So be patient or use the test ids above for testing. | ||
|
||
::: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.