react-native-google-mobile-ads 14.0.1 → 14.2.0

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.
Files changed (36) hide show
  1. package/__tests__/googleMobileAds.test.ts +16 -0
  2. package/android/app-json.gradle +8 -45
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.java +10 -0
  5. package/docs/ad-inspector.mdx +1 -1
  6. package/docs/common-reasons-for-ads-not-showing.mdx +13 -0
  7. package/docs/displaying-ads-hook.mdx +10 -6
  8. package/docs/displaying-ads.mdx +3 -1
  9. package/docs/european-user-consent.mdx +55 -22
  10. package/docs/index.mdx +132 -67
  11. package/docs/video-ad_volume-control.mdx +49 -0
  12. package/docs.json +26 -9
  13. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.mm +12 -0
  14. package/ios_config.sh +6 -34
  15. package/jest.setup.ts +2 -0
  16. package/lib/commonjs/MobileAds.js +7 -0
  17. package/lib/commonjs/MobileAds.js.map +1 -1
  18. package/lib/commonjs/NativeGoogleMobileAdsModule.js.map +1 -1
  19. package/lib/commonjs/version.js +1 -1
  20. package/lib/module/MobileAds.js +7 -0
  21. package/lib/module/MobileAds.js.map +1 -1
  22. package/lib/module/NativeGoogleMobileAdsModule.js.map +1 -1
  23. package/lib/module/version.js +1 -1
  24. package/lib/typescript/MobileAds.d.ts +2 -0
  25. package/lib/typescript/MobileAds.d.ts.map +1 -1
  26. package/lib/typescript/NativeGoogleMobileAdsModule.d.ts +2 -0
  27. package/lib/typescript/NativeGoogleMobileAdsModule.d.ts.map +1 -1
  28. package/lib/typescript/index.d.ts +1 -1
  29. package/lib/typescript/types/MobileAdsModule.interface.d.ts +26 -0
  30. package/lib/typescript/types/MobileAdsModule.interface.d.ts.map +1 -1
  31. package/lib/typescript/version.d.ts +1 -1
  32. package/package.json +5 -5
  33. package/src/MobileAds.ts +10 -0
  34. package/src/NativeGoogleMobileAdsModule.ts +2 -0
  35. package/src/types/MobileAdsModule.interface.ts +28 -0
  36. 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
  });
@@ -1,67 +1,30 @@
1
1
  import groovy.json.JsonOutput
2
2
  import groovy.json.JsonSlurper
3
3
 
4
- String[] fileNames = ["app.json", "app.config.js"]
5
- String fileName = null
4
+ String fileName = "app.json"
6
5
  String jsonRoot = "react-native-google-mobile-ads"
7
6
  String jsonRaw = "GOOGLE_MOBILE_ADS_JSON_RAW"
8
7
 
9
- File configFile = null
8
+ File jsonFile = null
10
9
  File parentDir = rootProject.projectDir
11
10
 
12
11
  for (int i = 0; i <= 3; i++) {
13
12
  if (parentDir == null) break
14
13
  parentDir = parentDir.parentFile
15
14
  if (parentDir != null) {
16
- configFile = new File(parentDir, fileNames[0])
17
- if (configFile.exists()) {
18
- fileName = fileNames[0]
19
- break
20
- }
21
- else {
22
- configFile = new File(parentDir, fileNames[1])
23
- if (configFile.exists()) {
24
- fileName = fileNames[0]
25
- break
26
- }
27
- }
15
+ jsonFile = new File(parentDir, fileName)
16
+ if (jsonFile.exists()) break
28
17
  }
29
18
  }
30
19
 
31
- if (configFile != null && configFile.exists()) {
32
- rootProject.logger.info ":${project.name} ${fileName} found at ${configFile.toString()}"
20
+ if (jsonFile != null && jsonFile.exists()) {
21
+ rootProject.logger.info ":${project.name} ${fileName} found at ${jsonFile.toString()}"
33
22
  Object json = null
34
23
 
35
24
  try {
36
- // On windows, we need to escape path separators in the path before exec'ing shell
37
- def configFileAbsolutePath = configFile.absolutePath
38
- if (System.properties['os.name'].toLowerCase().contains('windows')) {
39
- configFileAbsolutePath = configFileAbsolutePath.replace("\\", "\\\\")
40
- }
41
- // rootProject.logger.warn "have a path of ${configFileAbsolutePath}"
42
-
43
- // The config may be either in Expo javascript (app.config.js) or JSON (app.json)
44
- // If it is configured in Expo javascript, requiring it will generate a config
45
- // If it is configured in JSON, requiring it will also generate the config
46
- // So, use node to pull in the config file to get us a JSON string for either case
47
- def configOutput = new StringBuffer();
48
- def configReadProc = [
49
- "node",
50
- "-e",
51
- "console.log(JSON.stringify(require('${configFileAbsolutePath}')));"
52
- ]
53
- .execute(null, projectDir)
54
- configReadProc.waitForProcessOutput(configOutput, System.err)
55
- configOutput = configOutput.toString().trim()
56
- // rootProject.logger.warn "got configOutput of ${configOutput.toString()}"
57
-
58
- if (configOutput && !configOutput.isEmpty()) {
59
- json = new JsonSlurper().parseText(configOutput)
60
- } else {
61
- throw new Exception(":${project.name} received empty output while parsing ${configFile} found at ${configFile.toString()}.")
62
- }
25
+ json = new JsonSlurper().parseText(jsonFile.text)
63
26
  } catch (Exception ignored) {
64
- rootProject.logger.warn ":${project.name} failed to parse ${configFile} found at ${configFile.toString()}."
27
+ rootProject.logger.warn ":${project.name} failed to parse ${fileName} found at ${jsonFile.toString()}."
65
28
  rootProject.logger.warn ignored.toString()
66
29
  }
67
30
 
@@ -92,7 +92,7 @@ if (!appJSONGoogleMobileAdsAppIDString && !isExpoProject) {
92
92
  println "\n\n\n"
93
93
  println "**************************************************************************************************************"
94
94
  println "\n\n\n"
95
- println "ERROR: react-native-google-mobile-ads requires an 'android_app_id' property inside a 'react-native-google-mobile-ads' key in your app.json or app.config.js."
95
+ println "ERROR: react-native-google-mobile-ads requires an 'android_app_id' property inside a 'react-native-google-mobile-ads' key in your app.json."
96
96
  println " No android_app_id property was found in this location. The native Google Mobile Ads SDK will crash on startup without it."
97
97
  println "\n\n\n"
98
98
  println "**************************************************************************************************************"
@@ -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
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  The debug menu is a tool that allows you to test and debug your app's ad experience. It can be used to:
4
4
 
5
- ```
5
+ ```js
6
6
  await mobileAds().openDebugMenu(AD_UNIT_ID);
7
7
  ````
8
8
 
@@ -28,6 +28,19 @@ If you set up an app-ads.txt file for your app, you need to also include this li
28
28
 
29
29
  Alternatively, you can enable test devices and use your own ad unit IDs instead.
30
30
 
31
+ ### Check Your ApplicationId
32
+
33
+ If you initiated your project with `react-native init`, the auto-generated `applicationId` might not fulfill the required structure or uniqueness needed for AdMob integration. This can lead to issues where the request was succesfull but no ads are shown. Here are common reasons and fixes related to `applicationId` issues:
34
+
35
+ - **Non-unique ApplicationId**: The default `applicationId` may clash with existing apps, especially if you haven't customized it. AdMob requires a unique identifier for each app to correctly manage ad requests and revenue.
36
+
37
+ - **Improperly Structured ApplicationId**: The `applicationId` should generally follow Java package name conventions, such as `com.companyname.appname`. It must start with a letter, and can only include letters (a-z, A-Z), numbers (0-9), and underscores (_).
38
+
39
+ Google documentation: [Configure the app module](https://developer.android.com/build/configure-app-module?hl=de)
40
+
41
+ **Important**: If you change the application ID of an already published app, Google Play Store treats the upload as a completely different app!
42
+
43
+
31
44
  ### Enable test devices
32
45
 
33
46
  If you want to do more rigorous testing with production-looking ads, configure your device as a test device and use your own ad unit IDs that you've created in the AdMob UI.
@@ -20,9 +20,11 @@ export default function App() {
20
20
  }
21
21
  ```
22
22
 
23
- > The `adUnitid` parameter can also be used to manage creation and destruction of an ad instance.
24
- > If `adUnitid` is set or changed, new ad instance will be created and previous ad instance will be destroyed if exists.
25
- > If `adUnitid` is set to `null`, no ad instance will be created and previous ad instance will be destroyed if exists.
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
30
  Setting additional request options helps AdMob choose better tailored ads from the network. View the [`RequestOptions`](/reference/admob/requestoptions)
@@ -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
- > Note that `isOpened` value remains `true` even after the ad is closed.
96
- > The value changes to `false` when ad is initialized via calling `load()`.
97
- > To determine whether the ad is currently showing, use `isShowing` value.
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
@@ -423,7 +423,9 @@ function App() {
423
423
  The `size` prop takes a [`BannerAdSize`](/reference/admob/banneradsize) type, and once the advert is available, will
424
424
  fill the space for the chosen size.
425
425
 
426
- > If no inventory for the size specified is available, an error will be thrown via `onAdFailedToLoad`!
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
431
  Setting additional request options helps AdMob choose better tailored ads from the network. View the [`RequestOptions`](/reference/admob/requestoptions)
@@ -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
- > 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.
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, first of all:
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
- - Enable and configure GDPR and IDFA messaging in the [Privacy & messaging section of AdMob's Web Console](https://apps.admob.com/v2/privacymessaging).
25
+ <Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
26
+ <TabItem value="bare">
24
27
 
25
- - For Android, add the following rule into
26
- `android/app/proguard-rules.pro`:
27
- ```
28
- -keep class com.google.android.gms.internal.consent_sdk.** { *; }
29
- ```
30
- - For Expo users, add extraProguardRules property to `app.json` file following this guide [Expo](https://docs.expo.dev/versions/latest/sdk/build-properties/#pluginconfigtypeandroid):
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
- Once set, rebuild your application:
82
+ </TabItem>
83
+ <TabItem value="expo">
69
84
 
70
- ```bash
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
- # For Android
75
- npx react-native run-android
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
- #### For React Native projects (without Expo)
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
- #### For Expo projects
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
- # Installation
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
- yarn add react-native-google-mobile-ads
22
+ npm install react-native-google-mobile-ads
6
23
  ```
7
24
 
8
- > On Android, before releasing your app, you must select _Yes, my app contains ads_ in the Google Play Store, Policy, App content, Manage under Ads.
25
+ </TabItem>
26
+ <TabItem value="expo">
9
27
 
10
- ## Optionally configure iOS static frameworks
28
+ ```bash
29
+ # Install the admob module and config plugin
30
+ npx expo install react-native-google-mobile-ads
31
+ ```
11
32
 
12
- On iOS if you need to use static frameworks (that is, `use_frameworks! :linkage => :static` in your `Podfile`) you must add the variable `$RNGoogleMobileAdsAsStaticFramework = true` to the targets in your `Podfile`. You may need this if you use this module in combination with react-native-firebase v15 and higher since it requires `use_frameworks!`.
33
+ </TabItem>
34
+ </Tabs>
13
35
 
14
- Expo users may enable static frameworks by using the `expo-build-properties` plugin.
15
- 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` or `app.config.js` file:
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
- #### app.json
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
- #### app.config.js
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
- > Attempting to build your app without a valid App ID in `app.json` or `app.config.js` will cause the app to crash on start or fail to build.
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
- #### For React Native projects (without Expo)
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
- #### For Expo projects
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`, `app.config.js` or `app.config.ts` file.
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.
@@ -202,8 +208,10 @@ To learn more about the request configuration settings, view the [`RequestConfig
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
- > ⚠️ **Warning:** Ads may be preloaded by the Mobile Ads SDK or mediation partner SDKs upon calling `initialize`.
206
- > 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.
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
- #### For React Native projects (without Expo)
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
- #### For Expo projects
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
- // list of network ids removed to avoid duplication
303
- // please refer to the list in the `app.jaon` configuration section above
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
- #### For React Native projects (without Expo)
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
- #### For Expo projects
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
- ["Installation", "/"],
6
- ["Displaying Ads", "/displaying-ads"],
7
- ["Displaying Ads via Hook", "/displaying-ads-hook"],
8
- ["European User Consent", "/european-user-consent"],
9
- ["Ad Inspector", "/ad-inspector"],
10
- ["Impression-level ad revenue", "/impression-level-ad-revenue"],
11
- ["Common Reasons For Ads Not Showing", "/common-reasons-for-ads-not-showing"],
12
- ["Migrating to v5", "/migrating-to-v5"],
13
- ["Migrating to v6", "/migrating-to-v6"]
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
@@ -28,13 +28,6 @@
28
28
 
29
29
  set -e
30
30
 
31
- if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then
32
- source "$PODS_ROOT/../.xcode.env"
33
- fi
34
- if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then
35
- source "$PODS_ROOT/../.xcode.env.local"
36
- fi
37
-
38
31
  _MAX_LOOKUPS=2;
39
32
  _SEARCH_RESULT=''
40
33
  _RN_ROOT_EXISTS=''
@@ -42,13 +35,11 @@ _CURRENT_LOOKUPS=1
42
35
  _PROJECT_ABBREVIATION="RNGoogleMobileAds"
43
36
  _JSON_ROOT="'react-native-google-mobile-ads'"
44
37
  _JSON_FILE_NAME='app.json'
45
- _JS_APP_CONFIG_FILE_NAME='app.config.js'
46
38
  _JSON_OUTPUT_BASE64='e30=' # { }
47
39
  _CURRENT_SEARCH_DIR=${PROJECT_DIR}
48
40
  _PLIST_BUDDY=/usr/libexec/PlistBuddy
49
41
  _TARGET_PLIST="${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}"
50
42
  _DSYM_PLIST="${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist"
51
- _IS_CONFIG_JS=false
52
43
  _PACKAGE_JSON_NAME='package.json'
53
44
 
54
45
  # plist arrays
@@ -87,26 +78,13 @@ fi;
87
78
 
88
79
  while true; do
89
80
  _CURRENT_SEARCH_DIR=$(dirname "$_CURRENT_SEARCH_DIR")
90
-
91
- if [[ "$_CURRENT_SEARCH_DIR" == "/" ]] || [[ ${_CURRENT_LOOKUPS} -gt ${_MAX_LOOKUPS} ]]; then
92
- break;
93
- fi;
94
-
95
- echo "info: ($_CURRENT_LOOKUPS of $_MAX_LOOKUPS) Searching in '$_CURRENT_SEARCH_DIR' for a ${_JSON_FILE_NAME}/${_JS_APP_CONFIG_FILE_NAME} file."
96
-
97
- _SEARCH_RESULT=$(find "$_CURRENT_SEARCH_DIR" -maxdepth 2 \( -name ${_JSON_FILE_NAME} -o -name ${_JS_APP_CONFIG_FILE_NAME} \) -print | /usr/bin/head -n 1)
98
-
99
- if [[ "$(basename ${_SEARCH_RESULT})" = "${_JS_APP_CONFIG_FILE_NAME}" ]]; then
100
- _IS_CONFIG_JS=true
101
- echo "info: ${_JS_APP_CONFIG_FILE_NAME} found at $_SEARCH_RESULT"
81
+ if [[ "$_CURRENT_SEARCH_DIR" == "/" ]] || [[ ${_CURRENT_LOOKUPS} -gt ${_MAX_LOOKUPS} ]]; then break; fi;
82
+ echo "info: ($_CURRENT_LOOKUPS of $_MAX_LOOKUPS) Searching in '$_CURRENT_SEARCH_DIR' for a ${_JSON_FILE_NAME} file."
83
+ _SEARCH_RESULT=$(find "$_CURRENT_SEARCH_DIR" -maxdepth 2 -name ${_JSON_FILE_NAME} -print | /usr/bin/head -n 1)
84
+ if [[ ${_SEARCH_RESULT} ]]; then
85
+ echo "info: ${_JSON_FILE_NAME} found at $_SEARCH_RESULT"
102
86
  break;
103
87
  fi;
104
-
105
- if [[ "$(basename ${_SEARCH_RESULT})" = "${_JSON_FILE_NAME}" ]]; then
106
- echo "info: ${_JSON_FILE_NAME} found at ${_SEARCH_RESULT}"
107
- break;
108
- fi;
109
-
110
88
  _CURRENT_LOOKUPS=$((_CURRENT_LOOKUPS+1))
111
89
  done
112
90
 
@@ -120,12 +98,7 @@ if [[ ${_IS_PROJECT_USING_EXPO} == "true" ]]; then
120
98
  fi
121
99
 
122
100
  if [[ ${_SEARCH_RESULT} ]]; then
123
- if [[ ${_IS_CONFIG_JS} == "true" ]]; then
124
- _JSON_OUTPUT_RAW=$("${NODE_BINARY}" -e "console.log(JSON.stringify(require('${_SEARCH_RESULT}')));")
125
- else
126
- _JSON_OUTPUT_RAW=$(cat "${_SEARCH_RESULT}")
127
- fi;
128
-
101
+ _JSON_OUTPUT_RAW=$(cat "${_SEARCH_RESULT}")
129
102
  _RN_ROOT_EXISTS=$(ruby -KU -e "require 'rubygems';require 'json'; output=JSON.parse('$_JSON_OUTPUT_RAW'); puts output[$_JSON_ROOT]" || echo '')
130
103
 
131
104
  if [[ ${_RN_ROOT_EXISTS} ]]; then
@@ -225,4 +198,3 @@ for plist in "${_TARGET_PLIST}" "${_DSYM_PLIST}" ; do
225
198
  done
226
199
 
227
200
  echo "info: <- ${_PROJECT_ABBREVIATION} build script finished"
228
-
package/jest.setup.ts CHANGED
@@ -34,6 +34,8 @@ jest.doMock('react-native', () => {
34
34
  setRequestConfiguration: jest.fn(),
35
35
  openAdInspector: jest.fn(),
36
36
  openDebugMenu: jest.fn(),
37
+ setAppVolume: jest.fn(),
38
+ setAppMuted: jest.fn(),
37
39
  };
38
40
  },
39
41
  },
@@ -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,IAAIzB,eAAe,CAAC,CAAC;AAExC,MAAM0B,SAAS,GAAGA,CAAA,KAAM;EAC7B,OAAOD,iBAAiB;AAC1B,CAAC;AAACE,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAAA,IAAAE,QAAA,GAAAD,OAAA,CAAA9B,OAAA,GAEa6B,SAAS","ignoreList":[]}
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,GAYpCC,gCAAmB,CAACC,YAAY,CAAO,yBAAyB,CAAC","ignoreList":[]}
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":[]}
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // Generated by genversion.
8
- const version = exports.version = '14.0.1';
8
+ const version = exports.version = '14.2.0';
9
9
  //# sourceMappingURL=version.js.map
@@ -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,IAAItB,eAAe,CAAC,CAAC;AAE/C,OAAO,MAAMuB,SAAS,GAAGA,CAAA,KAAM;EAC7B,OAAOD,iBAAiB;AAC1B,CAAC;AAED,eAAeC,SAAS","ignoreList":[]}
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;AAYlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,yBAAyB,CAAC","ignoreList":[]}
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":[]}
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '14.0.1';
2
+ export const version = '14.2.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -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;CAI7B;AAID,eAAO,MAAM,SAAS,uBAErB,CAAC;AAEF,eAAe,SAAS,CAAC"}
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;CACrC;;AAED,wBAAiF"}
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.0.1";
1
+ export declare const SDK_VERSION = "14.2.0";
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;CACrC"}
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.0.1";
1
+ export declare const version = "14.2.0";
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.0.1",
3
+ "version": "14.2.0",
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",
@@ -43,16 +43,16 @@
43
43
  ],
44
44
  "sdkVersions": {
45
45
  "ios": {
46
- "googleMobileAds": "11.5.0",
47
- "googleUmp": "2.4.0"
46
+ "googleMobileAds": "11.7.0",
47
+ "googleUmp": "2.5.0"
48
48
  },
49
49
  "android": {
50
50
  "minSdk": 21,
51
51
  "targetSdk": 34,
52
52
  "compileSdk": 34,
53
53
  "buildTools": "34.0.0",
54
- "googleMobileAds": "23.1.0",
55
- "googleUmp": "2.2.0"
54
+ "googleMobileAds": "23.2.0",
55
+ "googleUmp": "3.0.0"
56
56
  }
57
57
  },
58
58
  "react-native-builder-bob": {
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.0.1';
2
+ export const version = '14.2.0';