react-native-google-mobile-ads 15.6.0 → 15.8.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.
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +12 -0
- package/docs/displaying-ads.mdx +2 -0
- package/docs/european-user-consent.mdx +12 -12
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m +8 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.mm +18 -0
- 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/types/BannerAdProps.d.ts +8 -0
- package/lib/typescript/types/BannerAdProps.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/ads/BaseAd.tsx +1 -1
- package/src/types/BannerAdProps.ts +10 -0
- package/src/version.ts +1 -1
|
@@ -57,6 +57,8 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
57
57
|
extends SimpleViewManager<ReactNativeAdView> {
|
|
58
58
|
private static final String REACT_CLASS = "RNGoogleMobileAdsBannerView";
|
|
59
59
|
private final String EVENT_AD_LOADED = "onAdLoaded";
|
|
60
|
+
private final String EVENT_AD_IMPRESSION = "onAdImpression";
|
|
61
|
+
private final String EVENT_AD_CLICKED = "onAdClicked";
|
|
60
62
|
private final String EVENT_AD_FAILED_TO_LOAD = "onAdFailedToLoad";
|
|
61
63
|
private final String EVENT_AD_OPENED = "onAdOpened";
|
|
62
64
|
private final String EVENT_AD_CLOSED = "onAdClosed";
|
|
@@ -283,6 +285,16 @@ public class ReactNativeGoogleMobileAdsBannerAdViewManager
|
|
|
283
285
|
public void onAdClosed() {
|
|
284
286
|
sendEvent(reactViewGroup, EVENT_AD_CLOSED, null);
|
|
285
287
|
}
|
|
288
|
+
|
|
289
|
+
@Override
|
|
290
|
+
public void onAdImpression() {
|
|
291
|
+
sendEvent(reactViewGroup, EVENT_AD_IMPRESSION, null);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
@Override
|
|
295
|
+
public void onAdClicked() {
|
|
296
|
+
sendEvent(reactViewGroup, EVENT_AD_CLICKED, null);
|
|
297
|
+
}
|
|
286
298
|
});
|
|
287
299
|
if (adView instanceof AdManagerAdView) {
|
|
288
300
|
((AdManagerAdView) adView)
|
package/docs/displaying-ads.mdx
CHANGED
|
@@ -456,6 +456,8 @@ or network triggers an event:
|
|
|
456
456
|
- `onAdFailedToLoad`
|
|
457
457
|
- `onAdLeftApplication`
|
|
458
458
|
- `onAdOpened`
|
|
459
|
+
- `onAdImpression`
|
|
460
|
+
- `onAdClicked`
|
|
459
461
|
- `onPaid` — On [impression-level ad revenue](https://support.google.com/admob/answer/11322405?hl=en) events.
|
|
460
462
|
|
|
461
463
|
Each render of the component loads a single advert, allowing you to display multiple adverts at once. If you need to reload/change
|
|
@@ -11,8 +11,8 @@ Android & iOS, and provides a single JavaScript interface for both platforms.
|
|
|
11
11
|
|
|
12
12
|
## Understanding AdMob Ads
|
|
13
13
|
|
|
14
|
-
Ads served by Google can be categorized as personalized
|
|
15
|
-
|
|
14
|
+
Ads served by Google can be categorized as personalized, non-personalized, Limited ads and technical ads. To understand more about what ads can be served based on a
|
|
15
|
+
user's consent choices, see Ad serving modes ([Android](https://developers.google.com/admob/android/privacy/ad-serving-modes) / [iOS](https://developers.google.com/admob/ios/privacy/ad-serving-modes)).
|
|
16
16
|
|
|
17
17
|
<Info>
|
|
18
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.
|
|
@@ -191,10 +191,13 @@ The completion handler is called after the form is dismissed. If consent is not
|
|
|
191
191
|
|
|
192
192
|
To make it easier we added a helper method `gatherConsent` that combines requesting consent information and loading/presenting a consent form if necessary.
|
|
193
193
|
|
|
194
|
-
Before requesting ads in your app, check if you have
|
|
194
|
+
Before requesting ads in your app, check if you have gathered consent aligned with your app's configured messages using `canRequestAds`.
|
|
195
195
|
If an error occurs during the consent gathering process, you should still attempt to request ads.
|
|
196
196
|
The UMP SDK uses the consent status from the previous session.
|
|
197
197
|
|
|
198
|
+
**Note:** For more information on when `canRequestAds` is `true` or `false`, see the reference documentation for [Android](https://developers.google.com/admob/android/reference/privacy/com/google/android/ump/ConsentInformation#canRequestAds()) /
|
|
199
|
+
[iOS](https://developers.google.com/admob/ios/privacy/api/reference/Classes/UMPConsentInformation#canrequestads).
|
|
200
|
+
|
|
198
201
|
```js
|
|
199
202
|
import mobileAds, { AdsConsent, AdsConsentStatus } from 'react-native-google-mobile-ads';
|
|
200
203
|
|
|
@@ -237,9 +240,8 @@ async function startGoogleMobileAdsSDK() {
|
|
|
237
240
|
|
|
238
241
|
### Inspecting consent choices
|
|
239
242
|
|
|
240
|
-
The AdsConsentStatus tells you if you should show the modal to a user or not. Often times you want to run logic based on the user's choices
|
|
241
|
-
|
|
242
|
-
This library exports a method that returns some of the most relevant consent flags to handle common use cases.
|
|
243
|
+
The AdsConsentStatus tells you if you should show the modal to a user or not. Often times you want to run logic based on the user's choices. This library exports a
|
|
244
|
+
method that returns some of the most relevant consent flags to handle common use cases.
|
|
243
245
|
|
|
244
246
|
```js
|
|
245
247
|
import { AdsConsent } from 'react-native-google-mobile-ads';
|
|
@@ -260,10 +262,7 @@ const {
|
|
|
260
262
|
} = await AdsConsent.getUserChoices();
|
|
261
263
|
|
|
262
264
|
if (storeAndAccessInformationOnDevice === false) {
|
|
263
|
-
|
|
264
|
-
* The user declined consent for purpose 1,
|
|
265
|
-
* the Google Mobile Ads SDK won't serve ads.
|
|
266
|
-
*/
|
|
265
|
+
// The user declined consent for purpose 1.
|
|
267
266
|
}
|
|
268
267
|
```
|
|
269
268
|
|
|
@@ -310,6 +309,7 @@ AdsConsent.reset();
|
|
|
310
309
|
|
|
311
310
|
### Troubleshooting
|
|
312
311
|
|
|
313
|
-
In case of troubles, double-check the
|
|
314
|
-
UMP SDK for [Android](https://developers.google.com/admob/ump/android/quick-start) /
|
|
312
|
+
In case of troubles, double-check the following artifacts:
|
|
313
|
+
* Original documentation for underlying UMP SDK for [Android](https://developers.google.com/admob/ump/android/quick-start) /
|
|
315
314
|
[iOS](https://developers.google.com/admob/ump/ios/quick-start).
|
|
315
|
+
* Google Help Center [European regulations](https://support.google.com/admob/topic/10115026) articles.
|
|
@@ -184,6 +184,14 @@
|
|
|
184
184
|
[self sendEvent:@"onAdOpened" payload:nil];
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
- (void)bannerViewDidRecordImpression:(GADBannerView *)bannerView {
|
|
188
|
+
[self sendEvent:@"onAdImpression" payload:nil];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
- (void)bannerViewDidRecordClick:(GADBannerView *)bannerView {
|
|
192
|
+
[self sendEvent:@"onAdClicked" payload:nil];
|
|
193
|
+
}
|
|
194
|
+
|
|
187
195
|
- (void)bannerViewWillDismissScreen:(GADBannerView *)bannerView {
|
|
188
196
|
// not in use
|
|
189
197
|
}
|
|
@@ -225,6 +225,24 @@ using namespace facebook::react;
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
+
- (void)bannerViewDidRecordImpression:(GADBannerView *)bannerView {
|
|
229
|
+
if (_eventEmitter != nullptr) {
|
|
230
|
+
std::dynamic_pointer_cast<const facebook::react::RNGoogleMobileAdsBannerViewEventEmitter>(
|
|
231
|
+
_eventEmitter)
|
|
232
|
+
->onNativeEvent(facebook::react::RNGoogleMobileAdsBannerViewEventEmitter::OnNativeEvent{
|
|
233
|
+
.type = "onAdImpression"});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
- (void)bannerViewDidRecordClick:(GADBannerView *)bannerView {
|
|
238
|
+
if (_eventEmitter != nullptr) {
|
|
239
|
+
std::dynamic_pointer_cast<const facebook::react::RNGoogleMobileAdsBannerViewEventEmitter>(
|
|
240
|
+
_eventEmitter)
|
|
241
|
+
->onNativeEvent(facebook::react::RNGoogleMobileAdsBannerViewEventEmitter::OnNativeEvent{
|
|
242
|
+
.type = "onAdClicked"});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
228
246
|
- (void)bannerViewWillDismissScreen:(GADBannerView *)bannerView {
|
|
229
247
|
// not in use
|
|
230
248
|
}
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "15.
|
|
1
|
+
export declare const SDK_VERSION = "15.8.0";
|
|
2
2
|
export { default, MobileAds } from './MobileAds';
|
|
3
3
|
export { AdsConsentDebugGeography, AdsConsentInfo, AdsConsentInfoOptions, AdsConsentInterface, AdsConsentPrivacyOptionsRequirementStatus, AdsConsentStatus, AdsConsentUserChoices, } from './specs/modules/NativeConsentModule';
|
|
4
4
|
export { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
@@ -74,6 +74,14 @@ export interface BannerAdProps {
|
|
|
74
74
|
* The ad is now visible to the user.
|
|
75
75
|
*/
|
|
76
76
|
onAdOpened?: () => void;
|
|
77
|
+
/**
|
|
78
|
+
* Called when an impression is recorded for an ad.
|
|
79
|
+
*/
|
|
80
|
+
onAdImpression?: () => void;
|
|
81
|
+
/**
|
|
82
|
+
* Called when a click is recorded for an ad
|
|
83
|
+
*/
|
|
84
|
+
onAdClicked?: () => void;
|
|
77
85
|
/**
|
|
78
86
|
* Called when the user is about to return to the app after tapping on an ad.
|
|
79
87
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerAdProps.d.ts","sourceRoot":"","sources":["../../../src/types/BannerAdProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA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EAAE,CAAC,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACxE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;IACnE;;;;OAIG;IACH,KAAK,EAAE,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;IAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC3C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "15.
|
|
1
|
+
export declare const version = "15.8.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": "15.
|
|
3
|
+
"version": "15.8.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,7 +43,7 @@
|
|
|
43
43
|
],
|
|
44
44
|
"sdkVersions": {
|
|
45
45
|
"ios": {
|
|
46
|
-
"googleMobileAds": "12.
|
|
46
|
+
"googleMobileAds": "12.11.0",
|
|
47
47
|
"googleUmp": "3.0.0"
|
|
48
48
|
},
|
|
49
49
|
"android": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"targetSdk": 34,
|
|
52
52
|
"compileSdk": 34,
|
|
53
53
|
"buildTools": "34.0.0",
|
|
54
|
-
"googleMobileAds": "24.
|
|
54
|
+
"googleMobileAds": "24.6.0",
|
|
55
55
|
"googleUmp": "3.2.0"
|
|
56
56
|
}
|
|
57
57
|
},
|
package/src/ads/BaseAd.tsx
CHANGED
|
@@ -80,6 +80,16 @@ export interface BannerAdProps {
|
|
|
80
80
|
*/
|
|
81
81
|
onAdOpened?: () => void;
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Called when an impression is recorded for an ad.
|
|
85
|
+
*/
|
|
86
|
+
onAdImpression?: () => void;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Called when a click is recorded for an ad
|
|
90
|
+
*/
|
|
91
|
+
onAdClicked?: () => void;
|
|
92
|
+
|
|
83
93
|
/**
|
|
84
94
|
* Called when the user is about to return to the app after tapping on an ad.
|
|
85
95
|
*/
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '15.
|
|
2
|
+
export const version = '15.8.0';
|