react-native-google-mobile-ads 14.1.0 → 14.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/googleMobileAds.test.ts +16 -0
- package/android/build.gradle +2 -3
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.java +10 -0
- package/docs/ad-inspector.mdx +1 -1
- package/docs/displaying-ads-hook.mdx +12 -8
- package/docs/displaying-ads.mdx +23 -21
- package/docs/european-user-consent.mdx +55 -22
- package/docs/index.mdx +133 -68
- package/docs/video-ad_volume-control.mdx +49 -0
- package/docs.json +26 -9
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.mm +12 -0
- package/ios_config.sh +3 -6
- package/jest.setup.ts +2 -0
- package/lib/commonjs/MobileAds.js +7 -0
- package/lib/commonjs/MobileAds.js.map +1 -1
- package/lib/commonjs/NativeGoogleMobileAdsModule.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/MobileAds.js +7 -0
- package/lib/module/MobileAds.js.map +1 -1
- package/lib/module/NativeGoogleMobileAdsModule.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/MobileAds.d.ts +2 -0
- package/lib/typescript/MobileAds.d.ts.map +1 -1
- package/lib/typescript/NativeGoogleMobileAdsModule.d.ts +2 -0
- package/lib/typescript/NativeGoogleMobileAdsModule.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/types/MobileAdsModule.interface.d.ts +26 -0
- package/lib/typescript/types/MobileAdsModule.interface.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/MobileAds.ts +10 -0
- package/src/NativeGoogleMobileAdsModule.ts +2 -0
- package/src/types/MobileAdsModule.interface.ts +28 -0
- package/src/version.ts +1 -1
|
@@ -87,6 +87,22 @@ describe('Admob', function () {
|
|
|
87
87
|
admob().openDebugMenu('');
|
|
88
88
|
}).toThrowError('openDebugMenu expected a non-empty string value');
|
|
89
89
|
});
|
|
90
|
+
|
|
91
|
+
it('does call native setAppVolume method', () => {
|
|
92
|
+
admob().setAppVolume(0.5);
|
|
93
|
+
expect(RNGoogleMobileAdsModule.setAppVolume).toBeCalledTimes(1);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('throws if setAppVolume is greater than 1', function () {
|
|
97
|
+
expect(() => {
|
|
98
|
+
admob().setAppVolume(2);
|
|
99
|
+
}).toThrowError('The app volume must be a value between 0 and 1 inclusive.');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('does call native setAppMuted method', () => {
|
|
103
|
+
admob().setAppMuted(true);
|
|
104
|
+
expect(RNGoogleMobileAdsModule.setAppMuted).toBeCalledTimes(1);
|
|
105
|
+
});
|
|
90
106
|
});
|
|
91
107
|
});
|
|
92
108
|
});
|
package/android/build.gradle
CHANGED
|
@@ -74,8 +74,7 @@ project.ext {
|
|
|
74
74
|
|
|
75
75
|
apply from: file("./app-json.gradle")
|
|
76
76
|
|
|
77
|
-
def
|
|
78
|
-
def isExpoProject = rootPackageJson['dependencies'].containsKey('expo')
|
|
77
|
+
def isManagedExpoProject = !rootProject.file("android").exists() && !rootProject.file("ios").exists()
|
|
79
78
|
def appJSONGoogleMobileAdsAppIDString = ""
|
|
80
79
|
def appJSONGoogleMobileAdsDelayAppMeasurementInitBool = false
|
|
81
80
|
def appJSONGoogleMobileAdsOptimizeInitializationBool = true
|
|
@@ -88,7 +87,7 @@ if (rootProject.ext.has("googleMobileAdsJson")) {
|
|
|
88
87
|
appJSONGoogleMobileAdsOptimizeAdLoadingBool = rootProject.ext.googleMobileAdsJson.isFlagEnabled("optimize_ad_loading", true)
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
if (!appJSONGoogleMobileAdsAppIDString && !
|
|
90
|
+
if (!appJSONGoogleMobileAdsAppIDString && !isManagedExpoProject) {
|
|
92
91
|
println "\n\n\n"
|
|
93
92
|
println "**************************************************************************************************************"
|
|
94
93
|
println "\n\n\n"
|
package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.java
CHANGED
|
@@ -194,4 +194,14 @@ public class ReactNativeGoogleMobileAdsModule extends ReactNativeModule {
|
|
|
194
194
|
.runOnUiThread(() -> MobileAds.openDebugMenu(getCurrentActivity(), adUnit));
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
+
|
|
198
|
+
@ReactMethod
|
|
199
|
+
public void setAppVolume(final Float volume) {
|
|
200
|
+
MobileAds.setAppVolume(volume);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@ReactMethod
|
|
204
|
+
public void setAppMuted(final Boolean muted) {
|
|
205
|
+
MobileAds.setAppMuted(muted);
|
|
206
|
+
}
|
|
197
207
|
}
|
package/docs/ad-inspector.mdx
CHANGED
|
@@ -20,13 +20,15 @@ export default function App() {
|
|
|
20
20
|
}
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
>
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
<Info>
|
|
24
|
+
The `adUnitid` parameter can also be used to manage creation and destruction of an ad instance.
|
|
25
|
+
If `adUnitid` is set or changed, new ad instance will be created and previous ad instance will be destroyed if exists.
|
|
26
|
+
If `adUnitid` is set to `null`, no ad instance will be created and previous ad instance will be destroyed if exists.
|
|
27
|
+
</Info>
|
|
26
28
|
|
|
27
29
|
The second argument is an additional optional request options object to be sent whilst loading an advert, such as keywords & location.
|
|
28
|
-
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
29
|
-
|
|
30
|
+
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
31
|
+
View the [`RequestOptions`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/types/RequestOptions.ts) source code to see the full range of options available.
|
|
30
32
|
|
|
31
33
|
## Show the ad
|
|
32
34
|
|
|
@@ -92,8 +94,10 @@ Return values of the hook are:
|
|
|
92
94
|
| load | Function | Start loading the advert with the provided RequestOptions. |
|
|
93
95
|
| show | Function | Show the loaded advert to the user. |
|
|
94
96
|
|
|
95
|
-
>
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
<Info>
|
|
98
|
+
Note that `isOpened` value remains `true` even after the ad is closed.
|
|
99
|
+
The value changes to `false` when ad is initialized via calling `load()`.
|
|
100
|
+
To determine whether the ad is currently showing, use `isShowing` value.
|
|
101
|
+
</Info>
|
|
98
102
|
|
|
99
103
|
[Impression-level ad revenue]: /impression-level-ad-revenue
|
package/docs/displaying-ads.mdx
CHANGED
|
@@ -80,10 +80,10 @@ const interstitial = InterstitialAd.createForAdRequest(adUnitId, {
|
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
The second argument is additional optional request options object to be sent whilst loading an advert, such as keywords & location.
|
|
83
|
-
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
84
|
-
|
|
83
|
+
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
84
|
+
View the [`RequestOptions`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/types/RequestOptions.ts) source code to see the full range of options available.
|
|
85
85
|
|
|
86
|
-
The call to `createForAdRequest` returns an instance of the [`InterstitialAd`](/
|
|
86
|
+
The call to `createForAdRequest` returns an instance of the [`InterstitialAd`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/ads/InterstitialAd.ts) class,
|
|
87
87
|
which provides a number of utilities for loading and displaying interstitials.
|
|
88
88
|
|
|
89
89
|
To listen to events, such as when the advert from the network has loaded or when an error occurs, we can subscribe via the
|
|
@@ -137,8 +137,8 @@ When pressed, the `show` method on the interstitial instance is called and the a
|
|
|
137
137
|
application.
|
|
138
138
|
|
|
139
139
|
You can subscribe to other various events with `addAdEventListener` listener such as if the user clicks the advert,
|
|
140
|
-
or closes the advert and returns back to your app.
|
|
141
|
-
[`AdEventType`](/
|
|
140
|
+
or closes the advert and returns back to your app.
|
|
141
|
+
To see the full list of available events, view the [`AdEventType`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/AdEventType.ts) source code.
|
|
142
142
|
|
|
143
143
|
If needed, you can reuse the existing instance of the `InterstitialAd` class to load more adverts and show them when required.
|
|
144
144
|
|
|
@@ -166,10 +166,10 @@ const rewarded = RewardedAd.createForAdRequest(adUnitId, {
|
|
|
166
166
|
```
|
|
167
167
|
|
|
168
168
|
The second argument is additional optional request options object to be sent whilst loading an advert, such as keywords & location.
|
|
169
|
-
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
170
|
-
|
|
169
|
+
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
170
|
+
View the [`RequestOptions`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/types/RequestOptions.ts) source code to see the full range of options available.
|
|
171
171
|
|
|
172
|
-
The call to `createForAdRequest` returns an instance of the [`RewardedAd`](/
|
|
172
|
+
The call to `createForAdRequest` returns an instance of the [`RewardedAd`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/ads/RewardedAd.ts) class,
|
|
173
173
|
which provides a number of utilities for loading and displaying rewarded ads.
|
|
174
174
|
|
|
175
175
|
To listen to events, such as when the advert from the network has loaded or when an error occurs, we can subscribe via the
|
|
@@ -235,13 +235,13 @@ Like Interstitial Ads, you can listen to the events with the `addAdEventListener
|
|
|
235
235
|
the advert and returns back to your app. However, you can listen to an extra `EARNED_REWARD` event which is triggered when user completes the
|
|
236
236
|
advert action. An additional `reward` payload is sent with the event, containing the amount and type of rewarded (specified via the dashboard).
|
|
237
237
|
|
|
238
|
-
To learn more, view the [`RewardedAdEventType`](/
|
|
238
|
+
To learn more, view the [`RewardedAdEventType`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/RewardedAdEventType.ts) source code.
|
|
239
239
|
|
|
240
240
|
If needed, you can reuse the existing instance of the `RewardedAd` class to load more adverts and show them when required.
|
|
241
241
|
|
|
242
242
|
While the `EARNED_REWARD` event only occurs on the client, Server Side Verification (or SSV) can be used for confirming a user completed an advert action. For this, you have to specify the Server Side Verification callback URL in your Ads dashboard.
|
|
243
243
|
|
|
244
|
-
You can customize SSV parameters when your SSV callback is called by setting the `serverSideVerificationOptions` field in your [`RequestOptions`](/
|
|
244
|
+
You can customize SSV parameters when your SSV callback is called by setting the `serverSideVerificationOptions` field in your [`RequestOptions`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/types/RequestOptions.ts) parameter.
|
|
245
245
|
|
|
246
246
|
```js
|
|
247
247
|
const rewardedAd = RewardedAd.createForAdRequest(adUnitId, {
|
|
@@ -286,10 +286,10 @@ const rewardedInterstitial = RewardedInterstitialAd.createForAdRequest(adUnitId,
|
|
|
286
286
|
```
|
|
287
287
|
|
|
288
288
|
The second argument is additional optional request options object to be sent whilst loading an advert, such as keywords & location.
|
|
289
|
-
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
290
|
-
|
|
289
|
+
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
290
|
+
View the [`RequestOptions`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/types/RequestOptions.ts) source code to see the full range of options available.
|
|
291
291
|
|
|
292
|
-
The call to `createForAdRequest` returns an instance of the [`RewardedInterstitialAd`](/
|
|
292
|
+
The call to `createForAdRequest` returns an instance of the [`RewardedInterstitialAd`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/ads/RewardedInterstitialAd.ts) class,
|
|
293
293
|
which provides a number of utilities for loading and displaying rewarded interstitial ads.
|
|
294
294
|
|
|
295
295
|
To listen to events, such as when the advert from the network has loaded or when an error occurs, we can subscribe via the
|
|
@@ -364,13 +364,13 @@ Like Interstitial Ads, you can listen to the events with the `addAdEventListener
|
|
|
364
364
|
the advert and returns back to your app. However, you can listen to an extra `EARNED_REWARD` event which is triggered when user completes the
|
|
365
365
|
advert action. An additional `reward` payload is sent with the event, containing the amount and type of rewarded (specified via the dashboard).
|
|
366
366
|
|
|
367
|
-
To learn more, view the [`RewardedAdEventType`](/
|
|
367
|
+
To learn more, view the [`RewardedAdEventType`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/RewardedAdEventType.ts) source code.
|
|
368
368
|
|
|
369
369
|
If needed, you can reuse the existing instance of the `RewardedInterstitialAd` class to load more adverts and show them when required.
|
|
370
370
|
|
|
371
371
|
While the `EARNED_REWARD` event only occurs on the client, Server Side Verification (or SSV) can be used for confirming a user completed an advert action. For this, you have to specify the Server Side Verification callback URL in your Ads dashboard.
|
|
372
372
|
|
|
373
|
-
You can customize SSV parameters when your SSV callback is called by setting the `serverSideVerificationOptions` field in your [`RequestOptions`](/
|
|
373
|
+
You can customize SSV parameters when your SSV callback is called by setting the `serverSideVerificationOptions` field in your [`RequestOptions`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/types/RequestOptions.ts) parameter.
|
|
374
374
|
|
|
375
375
|
```js
|
|
376
376
|
const rewardedInterstitialAd = RewardedInterstitialAd.createForAdRequest(adUnitId, {
|
|
@@ -395,7 +395,7 @@ Banner ads are partial adverts which can be integrated within your existing appl
|
|
|
395
395
|
a Banner only takes up a limited area of the application and displays an advert within the area. This allows you to integrate
|
|
396
396
|
adverts without a disruptive action.
|
|
397
397
|
|
|
398
|
-
The module exposes a [`BannerAd`](/
|
|
398
|
+
The module exposes a [`BannerAd`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/ads/BannerAd.tsx) component. The `unitId` and `size` props are required to display
|
|
399
399
|
a banner:
|
|
400
400
|
|
|
401
401
|
```js
|
|
@@ -420,14 +420,16 @@ function App() {
|
|
|
420
420
|
}
|
|
421
421
|
```
|
|
422
422
|
|
|
423
|
-
The `size` prop takes a [`BannerAdSize`](/
|
|
423
|
+
The `size` prop takes a [`BannerAdSize`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/BannerAdSize.ts) type, and once the advert is available, will
|
|
424
424
|
fill the space for the chosen size.
|
|
425
425
|
|
|
426
|
-
>
|
|
426
|
+
<Info>
|
|
427
|
+
If no inventory for the size specified is available, an error will be thrown via `onAdFailedToLoad`!
|
|
428
|
+
</Info>
|
|
427
429
|
|
|
428
430
|
The `requestOptions` prop is additional optional request options object to be sent whilst loading an advert, such as keywords & location.
|
|
429
|
-
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
430
|
-
documentation to view the full range of options available.
|
|
431
|
+
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
432
|
+
View the [`RequestOptions`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/types/RequestOptions.ts) documentation to view the full range of options available.
|
|
431
433
|
|
|
432
434
|
The component also exposes props for listening to events, which you can use to handle the state of your app is the user
|
|
433
435
|
or network triggers an event:
|
|
@@ -483,4 +485,4 @@ function App() {
|
|
|
483
485
|
}
|
|
484
486
|
```
|
|
485
487
|
|
|
486
|
-
The `sizes` prop takes an array of [`BannerAdSize`](/
|
|
488
|
+
The `sizes` prop takes an array of [`BannerAdSize`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/BannerAdSize.ts) types.
|
|
@@ -14,20 +14,27 @@ Android & iOS, and provides a single JavaScript interface for both platforms.
|
|
|
14
14
|
Ads served by Google can be categorized as personalized or non-personalized, both requiring consent from users in the EEA. By default,
|
|
15
15
|
ad requests to Google serve personalized ads, with ad selection based on the user's previously collected data. Users outside of the EEA do not require consent.
|
|
16
16
|
|
|
17
|
-
>
|
|
17
|
+
<Info>
|
|
18
|
+
The `AdsConsent` helper only provides you with the tools for requesting consent, it is up to the developer to ensure the consent status is reflected throughout the app.
|
|
19
|
+
</Info>
|
|
18
20
|
|
|
19
21
|
## Handling consent
|
|
20
22
|
|
|
21
|
-
To setup and configure ads consent collection,
|
|
23
|
+
To setup and configure ads consent collection, start by enabling and configuring GDPR and IDFA messaging in the [Privacy & messaging section of AdMob's Web Console](https://apps.admob.com/v2/privacymessaging).
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
<Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
|
|
26
|
+
<TabItem value="bare">
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
For Android, add the following rule into `android/app/proguard-rules.pro`:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
-keep class com.google.android.gms.internal.consent_sdk.** { *; }
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
</TabItem>
|
|
35
|
+
<TabItem value="expo">
|
|
36
|
+
|
|
37
|
+
Add the `extraProguardRules` property to `app.json` file as described in the [Expo documentation](https://docs.expo.dev/versions/latest/sdk/build-properties/#pluginconfigtypeandroid):
|
|
31
38
|
|
|
32
39
|
```json
|
|
33
40
|
{
|
|
@@ -48,14 +55,21 @@ To setup and configure ads consent collection, first of all:
|
|
|
48
55
|
|
|
49
56
|
You'll need to generate a new development build before using it.
|
|
50
57
|
|
|
58
|
+
</TabItem>
|
|
59
|
+
</Tabs>
|
|
60
|
+
|
|
51
61
|
### Delaying app measurement
|
|
52
62
|
|
|
53
63
|
By default, the Google Mobile Ads SDK initializes app measurement and begins sending user-level event data to Google immediately when the app starts.
|
|
54
64
|
If your app will be used by users within the EEA, it is important you prevent app measurement until your first ad has been requested (after consent).
|
|
55
65
|
|
|
66
|
+
<Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
|
|
67
|
+
<TabItem value="bare">
|
|
68
|
+
|
|
56
69
|
Within your projects `app.json` file, set the `delay_app_measurement_init` to `true` to delay app measurement:
|
|
57
70
|
|
|
58
71
|
```json
|
|
72
|
+
// <project-root>/app.json
|
|
59
73
|
{
|
|
60
74
|
"react-native-google-mobile-ads": {
|
|
61
75
|
"android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx",
|
|
@@ -65,23 +79,42 @@ Within your projects `app.json` file, set the `delay_app_measurement_init` to `t
|
|
|
65
79
|
}
|
|
66
80
|
```
|
|
67
81
|
|
|
68
|
-
|
|
82
|
+
</TabItem>
|
|
83
|
+
<TabItem value="expo">
|
|
69
84
|
|
|
70
|
-
|
|
71
|
-
# For iOS
|
|
72
|
-
npx react-native run-ios
|
|
85
|
+
Within your projects `app.json` file, set the `delayAppMeasurementInit` to `true` to delay app measurement:
|
|
73
86
|
|
|
74
|
-
|
|
75
|
-
|
|
87
|
+
```json
|
|
88
|
+
// <project-root>/app.json
|
|
89
|
+
{
|
|
90
|
+
"expo": {
|
|
91
|
+
"plugins": [
|
|
92
|
+
[
|
|
93
|
+
"react-native-google-mobile-ads",
|
|
94
|
+
{
|
|
95
|
+
"androidAppId": "ca-app-pub-xxxxxxxx~xxxxxxxx",
|
|
96
|
+
"iosAppId": "ca-app-pub-xxxxxxxx~xxxxxxxx",
|
|
97
|
+
"delayAppMeasurementInit": true
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
76
103
|
```
|
|
77
104
|
|
|
105
|
+
</TabItem>
|
|
106
|
+
</Tabs>
|
|
107
|
+
|
|
108
|
+
Once set, rebuild your application.
|
|
109
|
+
|
|
78
110
|
### App Tracking Transparency
|
|
79
111
|
|
|
80
112
|
If you configure an [ATT message](https://support.google.com/admob/answer/10115331) in your Google AdMob account, the UMP SDK will automatically handle the ATT alert.
|
|
81
113
|
This will also show an IDFA explainer message. If you don't want to show an explainer message you can show the ATT alert [manually](https://docs.page/invertase/react-native-google-mobile-ads#app-tracking-transparency-ios).
|
|
82
114
|
Also, within your projects `app.json` file, you have to provide a user tracking usage description (once set, rebuild your application):
|
|
83
115
|
|
|
84
|
-
|
|
116
|
+
<Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
|
|
117
|
+
<TabItem value="bare">
|
|
85
118
|
|
|
86
119
|
```json
|
|
87
120
|
// <project-root>/app.json
|
|
@@ -94,7 +127,8 @@ Also, within your projects `app.json` file, you have to provide a user tracking
|
|
|
94
127
|
}
|
|
95
128
|
```
|
|
96
129
|
|
|
97
|
-
|
|
130
|
+
</TabItem>
|
|
131
|
+
<TabItem value="expo">
|
|
98
132
|
|
|
99
133
|
```json
|
|
100
134
|
// <project-root>/app.json
|
|
@@ -114,6 +148,9 @@ Also, within your projects `app.json` file, you have to provide a user tracking
|
|
|
114
148
|
}
|
|
115
149
|
```
|
|
116
150
|
|
|
151
|
+
</TabItem>
|
|
152
|
+
</Tabs>
|
|
153
|
+
|
|
117
154
|
### Requesting consent information
|
|
118
155
|
|
|
119
156
|
It is recommended you request consent information each time your application starts to determine if the consent modal should be shown, e.g. due to provider changes.
|
|
@@ -140,7 +177,7 @@ the the actual user consent**. It simply indicates if you now have a consent res
|
|
|
140
177
|
(_i.e._ if user consent is **required**, the form has been presented, and user has
|
|
141
178
|
**denied** the consent, the status returned by this method will be `OBTAINED`,
|
|
142
179
|
and not `REQUIRED` as some may expect). To check the actual consent status
|
|
143
|
-
see [Inspecting consent choices] below.
|
|
180
|
+
see [Inspecting consent choices](/european-user-consent/#inspecting-consent-choices) below.
|
|
144
181
|
|
|
145
182
|
### Gathering user consent
|
|
146
183
|
|
|
@@ -280,7 +317,3 @@ AdsConsent.reset();
|
|
|
280
317
|
In case of troubles, double-check the original documentation for underlying
|
|
281
318
|
UMP SDK for [Android](https://developers.google.com/admob/ump/android/quick-start) /
|
|
282
319
|
[iOS](https://developers.google.com/admob/ump/ios/quick-start).
|
|
283
|
-
|
|
284
|
-
<!-- links -->
|
|
285
|
-
|
|
286
|
-
[inspecting consent choices]: #inspecting-consent-choices
|
package/docs/index.mdx
CHANGED
|
@@ -1,22 +1,60 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
The AdMob module allows you to display adverts to your users. All adverts are served over the Google AdMob network, meaning
|
|
4
|
+
a [Google AdMob account](https://apps.admob.com) is required.
|
|
5
|
+
|
|
6
|
+
<YouTube id="9qCxo0D-Sak" />
|
|
7
|
+
|
|
8
|
+
The module supports four types of Ads:
|
|
9
|
+
|
|
10
|
+
1. Full screen [App Open Ads](/displaying-ads#app-open-ads).
|
|
11
|
+
2. Full screen [Interstitial Ads](/displaying-ads#interstitial-ads).
|
|
12
|
+
3. Full screen [Rewarded Ads](/displaying-ads#rewarded-ads).
|
|
13
|
+
4. Component based [Banner Ads](/displaying-ads#banner-ads-component).
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
<Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
|
|
18
|
+
<TabItem value="bare">
|
|
2
19
|
|
|
3
20
|
```bash
|
|
4
21
|
# Install the admob module
|
|
5
|
-
|
|
22
|
+
npm install react-native-google-mobile-ads
|
|
6
23
|
```
|
|
7
24
|
|
|
8
|
-
>
|
|
25
|
+
</TabItem>
|
|
26
|
+
<TabItem value="expo">
|
|
9
27
|
|
|
10
|
-
|
|
28
|
+
```bash
|
|
29
|
+
# Install the admob module and config plugin
|
|
30
|
+
npx expo install react-native-google-mobile-ads
|
|
31
|
+
```
|
|
11
32
|
|
|
12
|
-
|
|
33
|
+
</TabItem>
|
|
34
|
+
</Tabs>
|
|
13
35
|
|
|
14
|
-
|
|
15
|
-
|
|
36
|
+
<Info>
|
|
37
|
+
On Android, before releasing your app, you must select "Yes, my app contains ads" in the Google Play Console under "Policy and programmes" > "App content" > "Manage".
|
|
38
|
+
</Info>
|
|
39
|
+
|
|
40
|
+
### Optionally configure iOS static frameworks
|
|
41
|
+
|
|
42
|
+
Follow these steps on iOS if you need to use static frameworks (that is, `use_frameworks! :linkage => :static` in your `Podfile`).
|
|
43
|
+
You may need this if you use this module in combination with `react-native-firebase` v15 and higher since it requires `use_frameworks!`.
|
|
44
|
+
|
|
45
|
+
<Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
|
|
46
|
+
<TabItem value="bare">
|
|
47
|
+
|
|
48
|
+
To enable static frameworks, you must add the variable `$RNGoogleMobileAdsAsStaticFramework = true` to the targets in your `Podfile`.
|
|
16
49
|
|
|
17
|
-
|
|
50
|
+
</TabItem>
|
|
51
|
+
<TabItem value="expo">
|
|
52
|
+
|
|
53
|
+
Expo users may enable static frameworks by using the `expo-build-properties` plugin.
|
|
54
|
+
To do so [follow the official `expo-build-properties` installation instructions](https://docs.expo.dev/versions/latest/sdk/build-properties/) and merge the following code into your `app.json` file:
|
|
18
55
|
|
|
19
56
|
```json
|
|
57
|
+
// <project-root>/app.json
|
|
20
58
|
{
|
|
21
59
|
"expo": {
|
|
22
60
|
"plugins": [
|
|
@@ -33,50 +71,8 @@ To do so [follow the official `expo-build-properties` installation instructions]
|
|
|
33
71
|
}
|
|
34
72
|
```
|
|
35
73
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
{
|
|
40
|
-
expo: {
|
|
41
|
-
plugins: [
|
|
42
|
-
[
|
|
43
|
-
'expo-build-properties',
|
|
44
|
-
{
|
|
45
|
-
ios: {
|
|
46
|
-
useFrameworks: 'static',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
];
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## What does it do
|
|
56
|
-
|
|
57
|
-
The AdMob module allows you to display adverts to your users. All adverts are served over the Google AdMob network, meaning
|
|
58
|
-
a [Google AdMob account](https://apps.admob.com) is required.
|
|
59
|
-
|
|
60
|
-
<YouTube id="9qCxo0D-Sak" />
|
|
61
|
-
|
|
62
|
-
The module supports four types of Ads:
|
|
63
|
-
|
|
64
|
-
1. Full screen [App Open Ads](/displaying-ads#app-open-ads).
|
|
65
|
-
2. Full screen [Interstitial Ads](/displaying-ads#interstitial-ads).
|
|
66
|
-
3. Full screen [Rewarded Ads](/displaying-ads#rewarded-ads).
|
|
67
|
-
4. Component based [Banner Ads](/displaying-ads#banner-ads).
|
|
68
|
-
|
|
69
|
-
## Getting Started
|
|
70
|
-
|
|
71
|
-
A number of steps must be taken and considered before you start serving adverts to your users:
|
|
72
|
-
|
|
73
|
-
- [Installation](#installation)
|
|
74
|
-
- [Getting Started](#getting-started)
|
|
75
|
-
- [Setting up Google AdMob](#setting-up-google-admob)
|
|
76
|
-
- [Configure outbound requests](#configure-outbound-requests)
|
|
77
|
-
- [European User Consent](#european-user-consent)
|
|
78
|
-
- [Test ads](#test-ads)
|
|
79
|
-
- [Next Steps](#next-steps)
|
|
74
|
+
</TabItem>
|
|
75
|
+
</Tabs>
|
|
80
76
|
|
|
81
77
|
### Setting up Google AdMob
|
|
82
78
|
|
|
@@ -84,7 +80,9 @@ Before you are able to display ads to your users, you must have a [Google AdMob
|
|
|
84
80
|
"Apps" menu item, create or choose an existing Android/iOS app. Each app platform exposes a unique account ID which needs to
|
|
85
81
|
be added to the project.
|
|
86
82
|
|
|
87
|
-
>
|
|
83
|
+
<Warning>
|
|
84
|
+
Attempting to build your app without a valid App ID in `app.json` will cause the app to crash on start or fail to build.
|
|
85
|
+
</Warning>
|
|
88
86
|
|
|
89
87
|
Under the "App settings" menu item, you can find the "App ID":
|
|
90
88
|
|
|
@@ -94,7 +92,9 @@ The app IDs for Android and iOS need to be inserted into your apps native code.
|
|
|
94
92
|
For React Native projects without Expo, you can add the app IDs to the `app.json` file.
|
|
95
93
|
For Expo projects, we provide an [Expo config plugin](https://docs.expo.dev/config-plugins/introduction/).
|
|
96
94
|
|
|
97
|
-
|
|
95
|
+
|
|
96
|
+
<Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
|
|
97
|
+
<TabItem value="bare">
|
|
98
98
|
|
|
99
99
|
```json
|
|
100
100
|
// <project-root>/app.json
|
|
@@ -117,11 +117,10 @@ npx react-native run-ios
|
|
|
117
117
|
npx react-native run-android
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
> ⚠️ This module contains custom native code which is NOT supported by Expo Go
|
|
120
|
+
</TabItem>
|
|
121
|
+
<TabItem value="expo">
|
|
123
122
|
|
|
124
|
-
This library contains an Expo config plugin which you must add to your `app.json
|
|
123
|
+
This library contains an Expo config plugin which you must add to your `app.json` file.
|
|
125
124
|
For these changes to take effect, your must rebuild your project's native code and install the new build on your device.
|
|
126
125
|
|
|
127
126
|
```json
|
|
@@ -141,6 +140,10 @@ For these changes to take effect, your must rebuild your project's native code a
|
|
|
141
140
|
}
|
|
142
141
|
```
|
|
143
142
|
|
|
143
|
+
<Warning>
|
|
144
|
+
️ This module contains custom native code which is NOT supported by Expo Go
|
|
145
|
+
</Warning>
|
|
146
|
+
|
|
144
147
|
If you're using Expo without EAS, run the following commands:
|
|
145
148
|
|
|
146
149
|
```bash
|
|
@@ -163,6 +166,9 @@ npx eas-cli build --profile development
|
|
|
163
166
|
npx eas-cli build --profile development --local
|
|
164
167
|
```
|
|
165
168
|
|
|
169
|
+
</TabItem>
|
|
170
|
+
</Tabs>
|
|
171
|
+
|
|
166
172
|
### Configure outbound requests
|
|
167
173
|
|
|
168
174
|
If the default ad settings are not correct for your app, you can provide settings that will apply to all ad requests.
|
|
@@ -195,15 +201,17 @@ mobileAds()
|
|
|
195
201
|
});
|
|
196
202
|
```
|
|
197
203
|
|
|
198
|
-
To learn more about the request configuration settings, view the [`RequestConfiguration`](/
|
|
204
|
+
To learn more about the request configuration settings, view the [`RequestConfiguration`](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/types/RequestConfiguration.ts) source code.
|
|
199
205
|
|
|
200
206
|
### Initialize the Google Mobile Ads SDK
|
|
201
207
|
|
|
202
208
|
Before loading ads, have your app initialize the Google Mobile Ads SDK by calling `initialize` which initializes the SDK and returns a promise once initialization is complete (or after a 30-second timeout).
|
|
203
209
|
This needs to be done only once, ideally at app launch.
|
|
204
210
|
|
|
205
|
-
>
|
|
206
|
-
|
|
211
|
+
<Warning>
|
|
212
|
+
Ads may be preloaded by the Mobile Ads SDK or mediation partner SDKs upon calling `initialize`.
|
|
213
|
+
If you need to obtain consent from users in the European Economic Area (EEA), set any request-specific flags (such as tagForChildDirectedTreatment), or otherwise take action before loading ads, ensure you do so before initializing the Mobile Ads SDK.
|
|
214
|
+
</Warning>
|
|
207
215
|
|
|
208
216
|
```js
|
|
209
217
|
import mobileAds from 'react-native-google-mobile-ads';
|
|
@@ -223,7 +231,8 @@ The Google Mobile Ads SDK supports conversion tracking using Apple's SKAdNetwork
|
|
|
223
231
|
Within your projects `app.json` file, add the advised [SKAdNetwork identifiers](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/3p-skadnetworks).
|
|
224
232
|
Note that these identifiers are subject to change and should be updated regularly.
|
|
225
233
|
|
|
226
|
-
|
|
234
|
+
<Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
|
|
235
|
+
<TabItem value="bare">
|
|
227
236
|
|
|
228
237
|
```json
|
|
229
238
|
// <project-root>/app.json
|
|
@@ -286,7 +295,8 @@ Note that these identifiers are subject to change and should be updated regularl
|
|
|
286
295
|
}
|
|
287
296
|
```
|
|
288
297
|
|
|
289
|
-
|
|
298
|
+
</TabItem>
|
|
299
|
+
<TabItem value="expo">
|
|
290
300
|
|
|
291
301
|
```json
|
|
292
302
|
// <project-root>/app.json
|
|
@@ -299,8 +309,55 @@ Note that these identifiers are subject to change and should be updated regularl
|
|
|
299
309
|
"androidAppId": "ca-app-pub-xxxxxxxx~xxxxxxxx",
|
|
300
310
|
"iosAppId": "ca-app-pub-xxxxxxxx~xxxxxxxx",
|
|
301
311
|
"skAdNetworkItems": [
|
|
302
|
-
|
|
303
|
-
|
|
312
|
+
"cstr6suwn9.skadnetwork",
|
|
313
|
+
"4fzdc2evr5.skadnetwork",
|
|
314
|
+
"4pfyvq9l8r.skadnetwork",
|
|
315
|
+
"2fnua5tdw4.skadnetwork",
|
|
316
|
+
"ydx93a7ass.skadnetwork",
|
|
317
|
+
"5a6flpkh64.skadnetwork",
|
|
318
|
+
"p78axxw29g.skadnetwork",
|
|
319
|
+
"v72qych5uu.skadnetwork",
|
|
320
|
+
"ludvb6z3bs.skadnetwork",
|
|
321
|
+
"cp8zw746q7.skadnetwork",
|
|
322
|
+
"3sh42y64q3.skadnetwork",
|
|
323
|
+
"c6k4g5qg8m.skadnetwork",
|
|
324
|
+
"s39g8k73mm.skadnetwork",
|
|
325
|
+
"3qy4746246.skadnetwork",
|
|
326
|
+
"f38h382jlk.skadnetwork",
|
|
327
|
+
"hs6bdukanm.skadnetwork",
|
|
328
|
+
"v4nxqhlyqp.skadnetwork",
|
|
329
|
+
"wzmmz9fp6w.skadnetwork",
|
|
330
|
+
"yclnxrl5pm.skadnetwork",
|
|
331
|
+
"t38b2kh725.skadnetwork",
|
|
332
|
+
"7ug5zh24hu.skadnetwork",
|
|
333
|
+
"gta9lk7p23.skadnetwork",
|
|
334
|
+
"vutu7akeur.skadnetwork",
|
|
335
|
+
"y5ghdn5j9k.skadnetwork",
|
|
336
|
+
"n6fk4nfna4.skadnetwork",
|
|
337
|
+
"v9wttpbfk9.skadnetwork",
|
|
338
|
+
"n38lu8286q.skadnetwork",
|
|
339
|
+
"47vhws6wlr.skadnetwork",
|
|
340
|
+
"kbd757ywx3.skadnetwork",
|
|
341
|
+
"9t245vhmpl.skadnetwork",
|
|
342
|
+
"eh6m2bh4zr.skadnetwork",
|
|
343
|
+
"a2p9lx4jpn.skadnetwork",
|
|
344
|
+
"22mmun2rn5.skadnetwork",
|
|
345
|
+
"4468km3ulz.skadnetwork",
|
|
346
|
+
"2u9pt9hc89.skadnetwork",
|
|
347
|
+
"8s468mfl3y.skadnetwork",
|
|
348
|
+
"klf5c3l5u5.skadnetwork",
|
|
349
|
+
"ppxm28t8ap.skadnetwork",
|
|
350
|
+
"ecpz2srf59.skadnetwork",
|
|
351
|
+
"uw77j35x4d.skadnetwork",
|
|
352
|
+
"pwa73g5rt2.skadnetwork",
|
|
353
|
+
"mlmmfzh3r3.skadnetwork",
|
|
354
|
+
"578prtvx9j.skadnetwork",
|
|
355
|
+
"4dzt52r2t5.skadnetwork",
|
|
356
|
+
"e5fvkxwrpn.skadnetwork",
|
|
357
|
+
"8c4e2ghe7u.skadnetwork",
|
|
358
|
+
"zq492l623r.skadnetwork",
|
|
359
|
+
"3rd42ekr43.skadnetwork",
|
|
360
|
+
"3qcr597p9d.skadnetwork"
|
|
304
361
|
],
|
|
305
362
|
}
|
|
306
363
|
]
|
|
@@ -309,12 +366,16 @@ Note that these identifiers are subject to change and should be updated regularl
|
|
|
309
366
|
}
|
|
310
367
|
```
|
|
311
368
|
|
|
369
|
+
</TabItem>
|
|
370
|
+
</Tabs>
|
|
371
|
+
|
|
312
372
|
### App Tracking Transparency (iOS)
|
|
313
373
|
|
|
314
374
|
Apple requires apps to display the App Tracking Transparency authorization request for accessing the IDFA (leaving the choice to the user, whether to use personalized or non-personalized ads).
|
|
315
375
|
Within your projects `app.json` file, you have to provide a user tracking usage description:
|
|
316
376
|
|
|
317
|
-
|
|
377
|
+
<Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
|
|
378
|
+
<TabItem value="bare">
|
|
318
379
|
|
|
319
380
|
```json
|
|
320
381
|
// <project-root>/app.json
|
|
@@ -327,7 +388,8 @@ Within your projects `app.json` file, you have to provide a user tracking usage
|
|
|
327
388
|
}
|
|
328
389
|
```
|
|
329
390
|
|
|
330
|
-
|
|
391
|
+
</TabItem>
|
|
392
|
+
<TabItem value="expo">
|
|
331
393
|
|
|
332
394
|
```json
|
|
333
395
|
// <project-root>/app.json
|
|
@@ -347,6 +409,9 @@ Within your projects `app.json` file, you have to provide a user tracking usage
|
|
|
347
409
|
}
|
|
348
410
|
```
|
|
349
411
|
|
|
412
|
+
</TabItem>
|
|
413
|
+
</Tabs>
|
|
414
|
+
|
|
350
415
|
#### Requesting App Tracking Transparency authorization
|
|
351
416
|
|
|
352
417
|
To request the App Tracking Transparency authorization we recommend using the [react-native-permissions](https://github.com/zoontek/react-native-permissions) library or making it part of the UMP consent flow [European User Consent page](/european-user-consent).
|
|
@@ -407,4 +472,4 @@ adverts to our users. The AdMob module provides integration with three different
|
|
|
407
472
|
- [App Open Ads](/displaying-ads#app-open-ads)
|
|
408
473
|
- [Interstitial Ads](/displaying-ads#interstitial-ads)
|
|
409
474
|
- [Rewarded Ads](/displaying-ads#rewarded-ads)
|
|
410
|
-
- [Banner Ads](/displaying-ads#banner-ads)
|
|
475
|
+
- [Banner Ads](/displaying-ads#banner-ads-component)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Video ad volume control
|
|
2
|
+
|
|
3
|
+
<Info>
|
|
4
|
+
Video volume controls apply only to Google ads and are not forwarded to mediation networks.
|
|
5
|
+
</Info>
|
|
6
|
+
|
|
7
|
+
If your app has its own volume controls, such as custom music or sound effect volumes, disclosing app volume to the Google Mobile Ads SDK enables video ads to respect app volume settings. This ensures users receive video ads with the expected audio volume.
|
|
8
|
+
|
|
9
|
+
The device volume, controlled through volume buttons or OS-level volume slider, determines the volume for device audio output. However, apps can independently adjust volume levels relative to the device volume to tailor the audio experience.
|
|
10
|
+
|
|
11
|
+
For App Open, Banner, Interstitial, Rewarded, and Rewarded Interstitial ad formats you can report the relative app volume to the Google Mobile Ads SDK by calling the `setAppVolume` function. Valid ad volume values range from `0.0` (silent) to `1.0` (current device volume). Here's an example of how to report the relative app volume to the SDK:
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import MobileAds, { GAMBannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
|
|
16
|
+
|
|
17
|
+
const adUnitId = __DEV__ ? TestIds.GAM_BANNER : '/xxx/yyyy';
|
|
18
|
+
|
|
19
|
+
function App() {
|
|
20
|
+
MobileAds().setAppVolume(0.5);
|
|
21
|
+
|
|
22
|
+
return <GAMBannerAd unitId={adUnitId} sizes={[BannerAdSize.FULL_BANNER]} />;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
<Error>
|
|
27
|
+
Lowering your app's audio volume reduces video ad eligibility and might reduce your app's ad revenue. You should only utilize this API if your app provides custom volume controls to the user, and the user's volume is properly reflected in the API.
|
|
28
|
+
</Error>
|
|
29
|
+
|
|
30
|
+
For App Open, Banner, Interstitial, Rewarded, and Rewarded Interstitial ad formats, you can inform the Google Mobile Ads SDK that the app volume has been muted by calling the `setAppMuted` function:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import React from 'react';
|
|
34
|
+
import MobileAds, { GAMBannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
|
|
35
|
+
|
|
36
|
+
const adUnitId = __DEV__ ? TestIds.GAM_BANNER : '/xxx/yyyy';
|
|
37
|
+
|
|
38
|
+
function App() {
|
|
39
|
+
MobileAds().setAppMuted(true);
|
|
40
|
+
|
|
41
|
+
return <GAMBannerAd unitId={adUnitId} sizes={[BannerAdSize.FULL_BANNER]} />;
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
By default, `appVolume` is set to 1 (the current device volume) and `appMuted` is set to `NO`.
|
|
46
|
+
|
|
47
|
+
<Error>
|
|
48
|
+
Muting your app reduces video ad eligibility and might reduce your app's ad revenue. You should only utilize this API if your app provides a custom mute control to the user, and the user's mute decision is properly reflected in the API.
|
|
49
|
+
</Error>
|
package/docs.json
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "React Native Google Mobile Ads",
|
|
3
|
+
"logo": "https://raw.githubusercontent.com/invertase/react-native-google-mobile-ads/main/docs/img/logo_admob_192px.svg",
|
|
3
4
|
"twitter": "invertaseio",
|
|
4
5
|
"sidebar": [
|
|
5
|
-
[
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
[
|
|
6
|
+
[
|
|
7
|
+
"Getting Started",
|
|
8
|
+
[
|
|
9
|
+
["Getting Started", "/"],
|
|
10
|
+
["Displaying Ads", "/displaying-ads"],
|
|
11
|
+
["Common Reasons For Ads Not Showing", "/common-reasons-for-ads-not-showing"]
|
|
12
|
+
]
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"Advanced Usage",
|
|
16
|
+
[
|
|
17
|
+
["Displaying Ads via Hook", "/displaying-ads-hook"],
|
|
18
|
+
["European User Consent", "/european-user-consent"],
|
|
19
|
+
["Ad Inspector", "/ad-inspector"],
|
|
20
|
+
["Impression-level ad revenue", "/impression-level-ad-revenue"],
|
|
21
|
+
["Video ad volume control", "/video-ad_volume-control"]
|
|
22
|
+
]
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
"Migration Guides",
|
|
26
|
+
[
|
|
27
|
+
["Migrating to v5", "/migrating-to-v5"],
|
|
28
|
+
["Migrating to v6", "/migrating-to-v6"]
|
|
29
|
+
]
|
|
30
|
+
]
|
|
14
31
|
]
|
|
15
32
|
}
|
|
@@ -67,6 +67,18 @@ RCT_EXPORT_METHOD(openDebugMenu : (NSString *)adUnit) {
|
|
|
67
67
|
#endif
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
RCT_EXPORT_METHOD(setAppVolume : (float)volume) {
|
|
71
|
+
#if !TARGET_OS_MACCATALYST
|
|
72
|
+
GADMobileAds.sharedInstance.applicationVolume = volume;
|
|
73
|
+
#endif
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
RCT_EXPORT_METHOD(setAppMuted : (BOOL *)muted) {
|
|
77
|
+
#if !TARGET_OS_MACCATALYST
|
|
78
|
+
GADMobileAds.sharedInstance.applicationMuted = muted;
|
|
79
|
+
#endif
|
|
80
|
+
}
|
|
81
|
+
|
|
70
82
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
71
83
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
72
84
|
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
package/ios_config.sh
CHANGED
|
@@ -88,12 +88,9 @@ while true; do
|
|
|
88
88
|
_CURRENT_LOOKUPS=$((_CURRENT_LOOKUPS+1))
|
|
89
89
|
done
|
|
90
90
|
|
|
91
|
-
# Bail out if project is
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if [[ ${_IS_PROJECT_USING_EXPO} == "true" ]]; then
|
|
96
|
-
echo "info: Expo project detected, assume Expo Config Plugin is used."
|
|
91
|
+
# Bail out if project is a managed Expo project:
|
|
92
|
+
if [[ ! -d "${PROJECT_DIR}/ios" ]] && [[ ! -d "${PROJECT_DIR}/android" ]]; then
|
|
93
|
+
echo "info: Project does not contain an ios or android folder, assume it's a managed Expo project using our Expo Config Plugin."
|
|
97
94
|
exit 0
|
|
98
95
|
fi
|
|
99
96
|
|
package/jest.setup.ts
CHANGED
|
@@ -48,6 +48,13 @@ class MobileAdsModule {
|
|
|
48
48
|
if (!adUnit) throw new Error('googleMobileAds.openDebugMenu expected a non-empty string value');
|
|
49
49
|
_NativeGoogleMobileAdsModule.default.openDebugMenu(adUnit);
|
|
50
50
|
}
|
|
51
|
+
setAppVolume(volume) {
|
|
52
|
+
if (volume < 0 || volume > 1) throw new Error('The app volume must be a value between 0 and 1 inclusive.');
|
|
53
|
+
_NativeGoogleMobileAdsModule.default.setAppVolume(volume);
|
|
54
|
+
}
|
|
55
|
+
setAppMuted(muted) {
|
|
56
|
+
_NativeGoogleMobileAdsModule.default.setAppMuted(muted);
|
|
57
|
+
}
|
|
51
58
|
}
|
|
52
59
|
const MobileAdsInstance = new MobileAdsModule();
|
|
53
60
|
const MobileAds = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_NativeGoogleMobileAdsModule","_interopRequireDefault","require","_validateAdRequestConfiguration","_SharedEventEmitter","_GoogleMobileAdsNativeEventEmitter","e","__esModule","default","NATIVE_MODULE_EVENT_SUBSCRIPTIONS","nativeEvents","MobileAdsModule","constructor","length","i","len","subscribeToNativeModuleEvent","eventName","GoogleMobileAdsNativeEventEmitter","addListener","event","SharedEventEmitter","emit","adUnitId","requestId","initialize","RNGoogleMobileAdsModule","setRequestConfiguration","requestConfiguration","config","validateAdRequestConfiguration","Error","message","openAdInspector","openDebugMenu","adUnit","MobileAdsInstance","MobileAds","exports","_default"],"sourceRoot":"../../src","sources":["MobileAds.ts"],"mappings":";;;;;;AAAA,IAAAA,4BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,+BAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,kCAAA,GAAAH,OAAA;AAAiG,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIjG,MAAMG,iCAA0D,GAAG,CAAC,CAAC;AAErE,MAAMC,YAAY,GAAG,CACnB,kCAAkC,EAClC,sCAAsC,EACtC,kCAAkC,EAClC,+CAA+C,CAChD;AAED,MAAMC,eAAe,CAAqC;EACxDC,WAAWA,CAAA,EAAG;IACZ,IAAIF,YAAY,IAAIA,YAAY,CAACG,MAAM,EAAE;MACvC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAGL,YAAY,CAACG,MAAM,EAAEC,CAAC,GAAGC,GAAG,EAAED,CAAC,EAAE,EAAE;QACvD,IAAI,CAACE,4BAA4B,CAACN,YAAY,CAACI,CAAC,CAAC,CAAC;MACpD;IACF;EACF;EAEAE,4BAA4BA,CAACC,SAAiB,EAAE;IAC9C,IAAI,CAACR,iCAAiC,CAACQ,SAAS,CAAC,EAAE;MACjDC,oEAAiC,CAACC,WAAW,CAACF,SAAS,EAAEG,KAAK,IAAI;QAChEC,sCAAkB,CAACC,IAAI,CAAC,GAAGL,SAAS,IAAIG,KAAK,CAACG,QAAQ,IAAIH,KAAK,CAACI,SAAS,EAAE,EAAEJ,KAAK,CAAC;MACrF,CAAC,CAAC;MAEFX,iCAAiC,CAACQ,SAAS,CAAC,GAAG,IAAI;IACrD;EACF;EAEAQ,UAAUA,CAAA,EAAG;IACX,OAAOC,oCAAuB,CAACD,UAAU,CAAC,CAAC;EAC7C;EAEAE,uBAAuBA,CAACC,oBAA0C,EAAE;IAClE,IAAIC,MAAM;IACV,IAAI;MACFA,MAAM,GAAG,IAAAC,8DAA8B,EAACF,oBAAoB,CAAC;IAC/D,CAAC,CAAC,OAAOtB,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYyB,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAC,8CAA8CzB,CAAC,CAAC0B,OAAO,EAAE,CAAC;MAC5E;IACF;IAEA,OAAON,oCAAuB,CAACC,uBAAuB,CAACE,MAAM,CAAC;EAChE;EAEAI,eAAeA,CAAA,EAAG;IAChB,OAAOP,oCAAuB,CAACO,eAAe,CAAC,CAAC;EAClD;EAEAC,aAAaA,CAACC,MAAc,EAAE;IAC5B,IAAI,CAACA,MAAM,EAAE,MAAM,IAAIJ,KAAK,CAAC,iEAAiE,CAAC;IAC/FL,oCAAuB,CAACQ,aAAa,CAACC,MAAM,CAAC;EAC/C;AACF;AAEA,MAAMC,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"names":["_NativeGoogleMobileAdsModule","_interopRequireDefault","require","_validateAdRequestConfiguration","_SharedEventEmitter","_GoogleMobileAdsNativeEventEmitter","e","__esModule","default","NATIVE_MODULE_EVENT_SUBSCRIPTIONS","nativeEvents","MobileAdsModule","constructor","length","i","len","subscribeToNativeModuleEvent","eventName","GoogleMobileAdsNativeEventEmitter","addListener","event","SharedEventEmitter","emit","adUnitId","requestId","initialize","RNGoogleMobileAdsModule","setRequestConfiguration","requestConfiguration","config","validateAdRequestConfiguration","Error","message","openAdInspector","openDebugMenu","adUnit","setAppVolume","volume","setAppMuted","muted","MobileAdsInstance","MobileAds","exports","_default"],"sourceRoot":"../../src","sources":["MobileAds.ts"],"mappings":";;;;;;AAAA,IAAAA,4BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,+BAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,kCAAA,GAAAH,OAAA;AAAiG,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIjG,MAAMG,iCAA0D,GAAG,CAAC,CAAC;AAErE,MAAMC,YAAY,GAAG,CACnB,kCAAkC,EAClC,sCAAsC,EACtC,kCAAkC,EAClC,+CAA+C,CAChD;AAED,MAAMC,eAAe,CAAqC;EACxDC,WAAWA,CAAA,EAAG;IACZ,IAAIF,YAAY,IAAIA,YAAY,CAACG,MAAM,EAAE;MACvC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAGL,YAAY,CAACG,MAAM,EAAEC,CAAC,GAAGC,GAAG,EAAED,CAAC,EAAE,EAAE;QACvD,IAAI,CAACE,4BAA4B,CAACN,YAAY,CAACI,CAAC,CAAC,CAAC;MACpD;IACF;EACF;EAEAE,4BAA4BA,CAACC,SAAiB,EAAE;IAC9C,IAAI,CAACR,iCAAiC,CAACQ,SAAS,CAAC,EAAE;MACjDC,oEAAiC,CAACC,WAAW,CAACF,SAAS,EAAEG,KAAK,IAAI;QAChEC,sCAAkB,CAACC,IAAI,CAAC,GAAGL,SAAS,IAAIG,KAAK,CAACG,QAAQ,IAAIH,KAAK,CAACI,SAAS,EAAE,EAAEJ,KAAK,CAAC;MACrF,CAAC,CAAC;MAEFX,iCAAiC,CAACQ,SAAS,CAAC,GAAG,IAAI;IACrD;EACF;EAEAQ,UAAUA,CAAA,EAAG;IACX,OAAOC,oCAAuB,CAACD,UAAU,CAAC,CAAC;EAC7C;EAEAE,uBAAuBA,CAACC,oBAA0C,EAAE;IAClE,IAAIC,MAAM;IACV,IAAI;MACFA,MAAM,GAAG,IAAAC,8DAA8B,EAACF,oBAAoB,CAAC;IAC/D,CAAC,CAAC,OAAOtB,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYyB,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAC,8CAA8CzB,CAAC,CAAC0B,OAAO,EAAE,CAAC;MAC5E;IACF;IAEA,OAAON,oCAAuB,CAACC,uBAAuB,CAACE,MAAM,CAAC;EAChE;EAEAI,eAAeA,CAAA,EAAG;IAChB,OAAOP,oCAAuB,CAACO,eAAe,CAAC,CAAC;EAClD;EAEAC,aAAaA,CAACC,MAAc,EAAE;IAC5B,IAAI,CAACA,MAAM,EAAE,MAAM,IAAIJ,KAAK,CAAC,iEAAiE,CAAC;IAC/FL,oCAAuB,CAACQ,aAAa,CAACC,MAAM,CAAC;EAC/C;EAEAC,YAAYA,CAACC,MAAc,EAAE;IAC3B,IAAIA,MAAM,GAAG,CAAC,IAAIA,MAAM,GAAG,CAAC,EAC1B,MAAM,IAAIN,KAAK,CAAC,2DAA2D,CAAC;IAC9EL,oCAAuB,CAACU,YAAY,CAACC,MAAM,CAAC;EAC9C;EAEAC,WAAWA,CAACC,KAAc,EAAE;IAC1Bb,oCAAuB,CAACY,WAAW,CAACC,KAAK,CAAC;EAC5C;AACF;AAEA,MAAMC,iBAAiB,GAAG,IAAI7B,eAAe,CAAC,CAAC;AAExC,MAAM8B,SAAS,GAAGA,CAAA,KAAM;EAC7B,OAAOD,iBAAiB;AAC1B,CAAC;AAACE,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAAA,IAAAE,QAAA,GAAAD,OAAA,CAAAlC,OAAA,GAEaiC,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGoogleMobileAdsModule.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGoogleMobileAdsModule.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAcpCC,gCAAmB,CAACC,YAAY,CAAO,yBAAyB,CAAC","ignoreList":[]}
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/MobileAds.js
CHANGED
|
@@ -41,6 +41,13 @@ class MobileAdsModule {
|
|
|
41
41
|
if (!adUnit) throw new Error('googleMobileAds.openDebugMenu expected a non-empty string value');
|
|
42
42
|
RNGoogleMobileAdsModule.openDebugMenu(adUnit);
|
|
43
43
|
}
|
|
44
|
+
setAppVolume(volume) {
|
|
45
|
+
if (volume < 0 || volume > 1) throw new Error('The app volume must be a value between 0 and 1 inclusive.');
|
|
46
|
+
RNGoogleMobileAdsModule.setAppVolume(volume);
|
|
47
|
+
}
|
|
48
|
+
setAppMuted(muted) {
|
|
49
|
+
RNGoogleMobileAdsModule.setAppMuted(muted);
|
|
50
|
+
}
|
|
44
51
|
}
|
|
45
52
|
const MobileAdsInstance = new MobileAdsModule();
|
|
46
53
|
export const MobileAds = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNGoogleMobileAdsModule","validateAdRequestConfiguration","SharedEventEmitter","GoogleMobileAdsNativeEventEmitter","NATIVE_MODULE_EVENT_SUBSCRIPTIONS","nativeEvents","MobileAdsModule","constructor","length","i","len","subscribeToNativeModuleEvent","eventName","addListener","event","emit","adUnitId","requestId","initialize","setRequestConfiguration","requestConfiguration","config","e","Error","message","openAdInspector","openDebugMenu","adUnit","MobileAdsInstance","MobileAds"],"sourceRoot":"../../src","sources":["MobileAds.ts"],"mappings":"AAAA,OAAOA,uBAAuB,MAAM,+BAA+B;AACnE,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,iCAAiC,QAAQ,8CAA8C;AAIhG,MAAMC,iCAA0D,GAAG,CAAC,CAAC;AAErE,MAAMC,YAAY,GAAG,CACnB,kCAAkC,EAClC,sCAAsC,EACtC,kCAAkC,EAClC,+CAA+C,CAChD;AAED,MAAMC,eAAe,CAAqC;EACxDC,WAAWA,CAAA,EAAG;IACZ,IAAIF,YAAY,IAAIA,YAAY,CAACG,MAAM,EAAE;MACvC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAGL,YAAY,CAACG,MAAM,EAAEC,CAAC,GAAGC,GAAG,EAAED,CAAC,EAAE,EAAE;QACvD,IAAI,CAACE,4BAA4B,CAACN,YAAY,CAACI,CAAC,CAAC,CAAC;MACpD;IACF;EACF;EAEAE,4BAA4BA,CAACC,SAAiB,EAAE;IAC9C,IAAI,CAACR,iCAAiC,CAACQ,SAAS,CAAC,EAAE;MACjDT,iCAAiC,CAACU,WAAW,CAACD,SAAS,EAAEE,KAAK,IAAI;QAChEZ,kBAAkB,CAACa,IAAI,CAAC,GAAGH,SAAS,IAAIE,KAAK,CAACE,QAAQ,IAAIF,KAAK,CAACG,SAAS,EAAE,EAAEH,KAAK,CAAC;MACrF,CAAC,CAAC;MAEFV,iCAAiC,CAACQ,SAAS,CAAC,GAAG,IAAI;IACrD;EACF;EAEAM,UAAUA,CAAA,EAAG;IACX,OAAOlB,uBAAuB,CAACkB,UAAU,CAAC,CAAC;EAC7C;EAEAC,uBAAuBA,CAACC,oBAA0C,EAAE;IAClE,IAAIC,MAAM;IACV,IAAI;MACFA,MAAM,GAAGpB,8BAA8B,CAACmB,oBAAoB,CAAC;IAC/D,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYC,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAC,8CAA8CD,CAAC,CAACE,OAAO,EAAE,CAAC;MAC5E;IACF;IAEA,OAAOxB,uBAAuB,CAACmB,uBAAuB,CAACE,MAAM,CAAC;EAChE;EAEAI,eAAeA,CAAA,EAAG;IAChB,OAAOzB,uBAAuB,CAACyB,eAAe,CAAC,CAAC;EAClD;EAEAC,aAAaA,CAACC,MAAc,EAAE;IAC5B,IAAI,CAACA,MAAM,EAAE,MAAM,IAAIJ,KAAK,CAAC,iEAAiE,CAAC;IAC/FvB,uBAAuB,CAAC0B,aAAa,CAACC,MAAM,CAAC;EAC/C;AACF;AAEA,MAAMC,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"names":["RNGoogleMobileAdsModule","validateAdRequestConfiguration","SharedEventEmitter","GoogleMobileAdsNativeEventEmitter","NATIVE_MODULE_EVENT_SUBSCRIPTIONS","nativeEvents","MobileAdsModule","constructor","length","i","len","subscribeToNativeModuleEvent","eventName","addListener","event","emit","adUnitId","requestId","initialize","setRequestConfiguration","requestConfiguration","config","e","Error","message","openAdInspector","openDebugMenu","adUnit","setAppVolume","volume","setAppMuted","muted","MobileAdsInstance","MobileAds"],"sourceRoot":"../../src","sources":["MobileAds.ts"],"mappings":"AAAA,OAAOA,uBAAuB,MAAM,+BAA+B;AACnE,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,iCAAiC,QAAQ,8CAA8C;AAIhG,MAAMC,iCAA0D,GAAG,CAAC,CAAC;AAErE,MAAMC,YAAY,GAAG,CACnB,kCAAkC,EAClC,sCAAsC,EACtC,kCAAkC,EAClC,+CAA+C,CAChD;AAED,MAAMC,eAAe,CAAqC;EACxDC,WAAWA,CAAA,EAAG;IACZ,IAAIF,YAAY,IAAIA,YAAY,CAACG,MAAM,EAAE;MACvC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAGL,YAAY,CAACG,MAAM,EAAEC,CAAC,GAAGC,GAAG,EAAED,CAAC,EAAE,EAAE;QACvD,IAAI,CAACE,4BAA4B,CAACN,YAAY,CAACI,CAAC,CAAC,CAAC;MACpD;IACF;EACF;EAEAE,4BAA4BA,CAACC,SAAiB,EAAE;IAC9C,IAAI,CAACR,iCAAiC,CAACQ,SAAS,CAAC,EAAE;MACjDT,iCAAiC,CAACU,WAAW,CAACD,SAAS,EAAEE,KAAK,IAAI;QAChEZ,kBAAkB,CAACa,IAAI,CAAC,GAAGH,SAAS,IAAIE,KAAK,CAACE,QAAQ,IAAIF,KAAK,CAACG,SAAS,EAAE,EAAEH,KAAK,CAAC;MACrF,CAAC,CAAC;MAEFV,iCAAiC,CAACQ,SAAS,CAAC,GAAG,IAAI;IACrD;EACF;EAEAM,UAAUA,CAAA,EAAG;IACX,OAAOlB,uBAAuB,CAACkB,UAAU,CAAC,CAAC;EAC7C;EAEAC,uBAAuBA,CAACC,oBAA0C,EAAE;IAClE,IAAIC,MAAM;IACV,IAAI;MACFA,MAAM,GAAGpB,8BAA8B,CAACmB,oBAAoB,CAAC;IAC/D,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYC,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAC,8CAA8CD,CAAC,CAACE,OAAO,EAAE,CAAC;MAC5E;IACF;IAEA,OAAOxB,uBAAuB,CAACmB,uBAAuB,CAACE,MAAM,CAAC;EAChE;EAEAI,eAAeA,CAAA,EAAG;IAChB,OAAOzB,uBAAuB,CAACyB,eAAe,CAAC,CAAC;EAClD;EAEAC,aAAaA,CAACC,MAAc,EAAE;IAC5B,IAAI,CAACA,MAAM,EAAE,MAAM,IAAIJ,KAAK,CAAC,iEAAiE,CAAC;IAC/FvB,uBAAuB,CAAC0B,aAAa,CAACC,MAAM,CAAC;EAC/C;EAEAC,YAAYA,CAACC,MAAc,EAAE;IAC3B,IAAIA,MAAM,GAAG,CAAC,IAAIA,MAAM,GAAG,CAAC,EAC1B,MAAM,IAAIN,KAAK,CAAC,2DAA2D,CAAC;IAC9EvB,uBAAuB,CAAC4B,YAAY,CAACC,MAAM,CAAC;EAC9C;EAEAC,WAAWA,CAACC,KAAc,EAAE;IAC1B/B,uBAAuB,CAAC8B,WAAW,CAACC,KAAK,CAAC;EAC5C;AACF;AAEA,MAAMC,iBAAiB,GAAG,IAAI1B,eAAe,CAAC,CAAC;AAE/C,OAAO,MAAM2B,SAAS,GAAGA,CAAA,KAAM;EAC7B,OAAOD,iBAAiB;AAC1B,CAAC;AAED,eAAeC,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGoogleMobileAdsModule.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGoogleMobileAdsModule.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAclD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,yBAAyB,CAAC","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -7,6 +7,8 @@ declare class MobileAdsModule implements MobileAdsModuleInterface {
|
|
|
7
7
|
setRequestConfiguration(requestConfiguration: RequestConfiguration): Promise<void>;
|
|
8
8
|
openAdInspector(): Promise<void>;
|
|
9
9
|
openDebugMenu(adUnit: string): void;
|
|
10
|
+
setAppVolume(volume: number): void;
|
|
11
|
+
setAppMuted(muted: boolean): void;
|
|
10
12
|
}
|
|
11
13
|
export declare const MobileAds: () => MobileAdsModule;
|
|
12
14
|
export default MobileAds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileAds.d.ts","sourceRoot":"","sources":["../../src/MobileAds.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAWpE,cAAM,eAAgB,YAAW,wBAAwB;;IASvD,4BAA4B,CAAC,SAAS,EAAE,MAAM;IAU9C,UAAU;IAIV,uBAAuB,CAAC,oBAAoB,EAAE,oBAAoB;IAalE,eAAe;IAIf,aAAa,CAAC,MAAM,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"MobileAds.d.ts","sourceRoot":"","sources":["../../src/MobileAds.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAWpE,cAAM,eAAgB,YAAW,wBAAwB;;IASvD,4BAA4B,CAAC,SAAS,EAAE,MAAM;IAU9C,UAAU;IAIV,uBAAuB,CAAC,oBAAoB,EAAE,oBAAoB;IAalE,eAAe;IAIf,aAAa,CAAC,MAAM,EAAE,MAAM;IAK5B,YAAY,CAAC,MAAM,EAAE,MAAM;IAM3B,WAAW,CAAC,KAAK,EAAE,OAAO;CAG3B;AAID,eAAO,MAAM,SAAS,uBAErB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -6,6 +6,8 @@ export interface Spec extends TurboModule {
|
|
|
6
6
|
setRequestConfiguration(requestConfiguration?: UnsafeObject): Promise<void>;
|
|
7
7
|
openAdInspector(): Promise<void>;
|
|
8
8
|
openDebugMenu(adUnit: string): void;
|
|
9
|
+
setAppVolume(volume: number): void;
|
|
10
|
+
setAppMuted(muted: boolean): void;
|
|
9
11
|
}
|
|
10
12
|
declare const _default: Spec;
|
|
11
13
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeGoogleMobileAdsModule.d.ts","sourceRoot":"","sources":["../../src/NativeGoogleMobileAdsModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACvC,uBAAuB,CAAC,oBAAoB,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"NativeGoogleMobileAdsModule.d.ts","sourceRoot":"","sources":["../../src/NativeGoogleMobileAdsModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACvC,uBAAuB,CAAC,oBAAoB,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACnC;;AAED,wBAAiF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "14.1
|
|
1
|
+
export declare const SDK_VERSION = "14.2.1";
|
|
2
2
|
export { default, MobileAds } from './MobileAds';
|
|
3
3
|
export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
|
|
4
4
|
export { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
@@ -45,5 +45,31 @@ export interface MobileAdsModuleInterface {
|
|
|
45
45
|
* @param adUnit Any valid ad unit from your Ad Manager account is sufficient to open the debug options menu.
|
|
46
46
|
*/
|
|
47
47
|
openDebugMenu(adUnit: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the application's audio volume. Affects audio volumes of all ads relative to other audio output.
|
|
50
|
+
*
|
|
51
|
+
* Warning: Lowering your app's audio volume reduces video ad eligibility and may reduce your app's ad revenue.
|
|
52
|
+
* You should only utilize this API if your app provides custom volume controls to the user, and you should reflect
|
|
53
|
+
* the user's volume choice in this API.
|
|
54
|
+
*
|
|
55
|
+
* @see https://developers.google.com/ad-manager/mobile-ads-sdk/android/global-settings
|
|
56
|
+
* @see https://developers.google.com/ad-manager/mobile-ads-sdk/ios/global-settings
|
|
57
|
+
*
|
|
58
|
+
* @param volume the volume as a float from 0 (muted) to 1.0 (full media volume). Defaults to 1.0
|
|
59
|
+
*/
|
|
60
|
+
setAppVolume(volume: number): void;
|
|
61
|
+
/**
|
|
62
|
+
* Indicates whether the application's audio is muted. Affects initial mute state for all ads.
|
|
63
|
+
*
|
|
64
|
+
* Warning: Muting your application reduces video ad eligibility and may reduce your app's ad revenue.
|
|
65
|
+
* You should only utilize this API if your app provides a custom mute control to the user, and you should
|
|
66
|
+
* reflect the user's mute decision in this API.
|
|
67
|
+
*
|
|
68
|
+
* @see https://developers.google.com/ad-manager/mobile-ads-sdk/android/global-settings
|
|
69
|
+
* @see https://developers.google.com/ad-manager/mobile-ads-sdk/ios/global-settings
|
|
70
|
+
*
|
|
71
|
+
* @param muted true if the app is muted, false otherwise. Defaults to false.
|
|
72
|
+
*/
|
|
73
|
+
setAppMuted(muted: boolean): void;
|
|
48
74
|
}
|
|
49
75
|
//# sourceMappingURL=MobileAdsModule.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileAdsModule.interface.d.ts","sourceRoot":"","sources":["../../../src/types/MobileAdsModule.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAEvC;;;;;;;;;;;;;;;OAeG;IACH,uBAAuB,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnF;;;;;;;OAOG;IACH,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC;;;;;;;;;OASG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"MobileAdsModule.interface.d.ts","sourceRoot":"","sources":["../../../src/types/MobileAdsModule.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAEvC;;;;;;;;;;;;;;;OAeG;IACH,uBAAuB,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnF;;;;;;;OAOG;IACH,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC;;;;;;;;;OASG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACnC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "14.1
|
|
1
|
+
export declare const version = "14.2.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-google-mobile-ads",
|
|
3
|
-
"version": "14.1
|
|
3
|
+
"version": "14.2.1",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Google Mobile Ads is an easy way to monetize mobile apps with targeted, in-app advertising.",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
package/src/MobileAds.ts
CHANGED
|
@@ -58,6 +58,16 @@ class MobileAdsModule implements MobileAdsModuleInterface {
|
|
|
58
58
|
if (!adUnit) throw new Error('googleMobileAds.openDebugMenu expected a non-empty string value');
|
|
59
59
|
RNGoogleMobileAdsModule.openDebugMenu(adUnit);
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
setAppVolume(volume: number) {
|
|
63
|
+
if (volume < 0 || volume > 1)
|
|
64
|
+
throw new Error('The app volume must be a value between 0 and 1 inclusive.');
|
|
65
|
+
RNGoogleMobileAdsModule.setAppVolume(volume);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
setAppMuted(muted: boolean) {
|
|
69
|
+
RNGoogleMobileAdsModule.setAppMuted(muted);
|
|
70
|
+
}
|
|
61
71
|
}
|
|
62
72
|
|
|
63
73
|
const MobileAdsInstance = new MobileAdsModule();
|
|
@@ -9,6 +9,8 @@ export interface Spec extends TurboModule {
|
|
|
9
9
|
setRequestConfiguration(requestConfiguration?: UnsafeObject): Promise<void>;
|
|
10
10
|
openAdInspector(): Promise<void>;
|
|
11
11
|
openDebugMenu(adUnit: string): void;
|
|
12
|
+
setAppVolume(volume: number): void;
|
|
13
|
+
setAppMuted(muted: boolean): void;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export default TurboModuleRegistry.getEnforcing<Spec>('RNGoogleMobileAdsModule');
|
|
@@ -49,4 +49,32 @@ export interface MobileAdsModuleInterface {
|
|
|
49
49
|
* @param adUnit Any valid ad unit from your Ad Manager account is sufficient to open the debug options menu.
|
|
50
50
|
*/
|
|
51
51
|
openDebugMenu(adUnit: string): void;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Sets the application's audio volume. Affects audio volumes of all ads relative to other audio output.
|
|
55
|
+
*
|
|
56
|
+
* Warning: Lowering your app's audio volume reduces video ad eligibility and may reduce your app's ad revenue.
|
|
57
|
+
* You should only utilize this API if your app provides custom volume controls to the user, and you should reflect
|
|
58
|
+
* the user's volume choice in this API.
|
|
59
|
+
*
|
|
60
|
+
* @see https://developers.google.com/ad-manager/mobile-ads-sdk/android/global-settings
|
|
61
|
+
* @see https://developers.google.com/ad-manager/mobile-ads-sdk/ios/global-settings
|
|
62
|
+
*
|
|
63
|
+
* @param volume the volume as a float from 0 (muted) to 1.0 (full media volume). Defaults to 1.0
|
|
64
|
+
*/
|
|
65
|
+
setAppVolume(volume: number): void;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Indicates whether the application's audio is muted. Affects initial mute state for all ads.
|
|
69
|
+
*
|
|
70
|
+
* Warning: Muting your application reduces video ad eligibility and may reduce your app's ad revenue.
|
|
71
|
+
* You should only utilize this API if your app provides a custom mute control to the user, and you should
|
|
72
|
+
* reflect the user's mute decision in this API.
|
|
73
|
+
*
|
|
74
|
+
* @see https://developers.google.com/ad-manager/mobile-ads-sdk/android/global-settings
|
|
75
|
+
* @see https://developers.google.com/ad-manager/mobile-ads-sdk/ios/global-settings
|
|
76
|
+
*
|
|
77
|
+
* @param muted true if the app is muted, false otherwise. Defaults to false.
|
|
78
|
+
*/
|
|
79
|
+
setAppMuted(muted: boolean): void;
|
|
52
80
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '14.1
|
|
2
|
+
export const version = '14.2.1';
|