react-native-google-mobile-ads 14.2.0 → 14.2.2
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/android/build.gradle +5 -7
- package/docs/displaying-ads-hook.mdx +2 -2
- package/docs/displaying-ads.mdx +20 -20
- package/docs/index.mdx +1 -1
- package/ios_config.sh +3 -11
- package/lib/commonjs/version.js +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/version.ts +1 -1
package/android/build.gradle
CHANGED
|
@@ -74,30 +74,28 @@ project.ext {
|
|
|
74
74
|
|
|
75
75
|
apply from: file("./app-json.gradle")
|
|
76
76
|
|
|
77
|
-
def rootPackageJson = PackageJson.getForProject(rootProject)
|
|
78
|
-
def isExpoProject = rootPackageJson['dependencies'].containsKey('expo')
|
|
79
77
|
def appJSONGoogleMobileAdsAppIDString = ""
|
|
80
78
|
def appJSONGoogleMobileAdsDelayAppMeasurementInitBool = false
|
|
81
79
|
def appJSONGoogleMobileAdsOptimizeInitializationBool = true
|
|
82
80
|
def appJSONGoogleMobileAdsOptimizeAdLoadingBool = true
|
|
83
81
|
|
|
84
|
-
if (rootProject.ext.has("googleMobileAdsJson")) {
|
|
82
|
+
if (rootProject.ext.has("googleMobileAdsJson") && rootProject.ext.googleMobileAdsJson) {
|
|
85
83
|
appJSONGoogleMobileAdsAppIDString = rootProject.ext.googleMobileAdsJson.getStringValue("android_app_id", "")
|
|
86
84
|
appJSONGoogleMobileAdsDelayAppMeasurementInitBool = rootProject.ext.googleMobileAdsJson.isFlagEnabled("delay_app_measurement_init", false)
|
|
87
85
|
appJSONGoogleMobileAdsOptimizeInitializationBool = rootProject.ext.googleMobileAdsJson.isFlagEnabled("optimize_initialization", true)
|
|
88
86
|
appJSONGoogleMobileAdsOptimizeAdLoadingBool = rootProject.ext.googleMobileAdsJson.isFlagEnabled("optimize_ad_loading", true)
|
|
89
87
|
}
|
|
90
88
|
|
|
91
|
-
if (!appJSONGoogleMobileAdsAppIDString
|
|
89
|
+
if (!appJSONGoogleMobileAdsAppIDString) {
|
|
92
90
|
println "\n\n\n"
|
|
93
91
|
println "**************************************************************************************************************"
|
|
94
92
|
println "\n\n\n"
|
|
95
|
-
println "
|
|
96
|
-
println "
|
|
93
|
+
println "WARNING: react-native-google-mobile-ads requires an 'android_app_id' property inside a 'react-native-google-mobile-ads' key in your app.json."
|
|
94
|
+
println " No android_app_id property was found in this location. The native Google Mobile Ads SDK will crash on startup without it."
|
|
95
|
+
println " You can safely ignore this warning if you are using our Expo config plugin."
|
|
97
96
|
println "\n\n\n"
|
|
98
97
|
println "**************************************************************************************************************"
|
|
99
98
|
println "\n\n\n"
|
|
100
|
-
System.exit(1)
|
|
101
99
|
}
|
|
102
100
|
|
|
103
101
|
android {
|
|
@@ -27,8 +27,8 @@ If `adUnitid` is set to `null`, no ad instance will be created and previous ad i
|
|
|
27
27
|
</Info>
|
|
28
28
|
|
|
29
29
|
The second argument is an additional optional request options object to be sent whilst loading an advert, such as keywords & location.
|
|
30
|
-
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
31
|
-
|
|
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.
|
|
32
32
|
|
|
33
33
|
## Show the ad
|
|
34
34
|
|
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,7 +420,7 @@ 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>
|
|
@@ -428,8 +428,8 @@ If no inventory for the size specified is available, an error will be thrown via
|
|
|
428
428
|
</Info>
|
|
429
429
|
|
|
430
430
|
The `requestOptions` prop is additional optional request options object to be sent whilst loading an advert, such as keywords & location.
|
|
431
|
-
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
432
|
-
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.
|
|
433
433
|
|
|
434
434
|
The component also exposes props for listening to events, which you can use to handle the state of your app is the user
|
|
435
435
|
or network triggers an event:
|
|
@@ -485,4 +485,4 @@ function App() {
|
|
|
485
485
|
}
|
|
486
486
|
```
|
|
487
487
|
|
|
488
|
-
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.
|
package/docs/index.mdx
CHANGED
|
@@ -201,7 +201,7 @@ mobileAds()
|
|
|
201
201
|
});
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
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.
|
|
205
205
|
|
|
206
206
|
### Initialize the Google Mobile Ads SDK
|
|
207
207
|
|
package/ios_config.sh
CHANGED
|
@@ -88,15 +88,6 @@ while true; do
|
|
|
88
88
|
_CURRENT_LOOKUPS=$((_CURRENT_LOOKUPS+1))
|
|
89
89
|
done
|
|
90
90
|
|
|
91
|
-
# Bail out if project is using Expo
|
|
92
|
-
_PACKAGE_JSON_PATH=$(dirname "${_SEARCH_RESULT}")/${_PACKAGE_JSON_NAME}
|
|
93
|
-
_IS_PROJECT_USING_EXPO=$(ruby -KU -e "require 'json'; package=JSON.parse(File.read('${_PACKAGE_JSON_PATH}')); puts package['dependencies'].key?('expo')")
|
|
94
|
-
|
|
95
|
-
if [[ ${_IS_PROJECT_USING_EXPO} == "true" ]]; then
|
|
96
|
-
echo "info: Expo project detected, assume Expo Config Plugin is used."
|
|
97
|
-
exit 0
|
|
98
|
-
fi
|
|
99
|
-
|
|
100
91
|
if [[ ${_SEARCH_RESULT} ]]; then
|
|
101
92
|
_JSON_OUTPUT_RAW=$(cat "${_SEARCH_RESULT}")
|
|
102
93
|
_RN_ROOT_EXISTS=$(ruby -KU -e "require 'rubygems';require 'json'; output=JSON.parse('$_JSON_OUTPUT_RAW'); puts output[$_JSON_ROOT]" || echo '')
|
|
@@ -172,8 +163,9 @@ if ! [[ -f "${_TARGET_PLIST}" ]]; then
|
|
|
172
163
|
fi
|
|
173
164
|
|
|
174
165
|
if ! [[ $_IOS_APP_ID ]]; then
|
|
175
|
-
echo "
|
|
176
|
-
|
|
166
|
+
echo "warning: ios_app_id key not found in react-native-google-mobile-ads key in app.json. App will crash without it."
|
|
167
|
+
echo " You can safely ignore this warning if you are using our Expo config plugin."
|
|
168
|
+
exit 0
|
|
177
169
|
fi
|
|
178
170
|
|
|
179
171
|
for plist in "${_TARGET_PLIST}" "${_DSYM_PLIST}" ; do
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "14.2.
|
|
1
|
+
export declare const SDK_VERSION = "14.2.2";
|
|
2
2
|
export { default, MobileAds } from './MobileAds';
|
|
3
3
|
export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
|
|
4
4
|
export { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "14.2.
|
|
1
|
+
export declare const version = "14.2.2";
|
|
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.2.
|
|
3
|
+
"version": "14.2.2",
|
|
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/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '14.2.
|
|
2
|
+
export const version = '14.2.2';
|