react-native-google-mobile-ads 13.2.1 → 13.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/io/invertase/googlemobileads/OnNativeEvent.kt +1 -1
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java +9 -2
- package/docs/displaying-ads.mdx +23 -13
- 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/RequestOptions.d.ts +2 -2
- package/lib/typescript/types/RequestOptions.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/types/RequestOptions.ts +2 -2
- package/src/version.ts +1 -1
package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java
CHANGED
|
@@ -178,8 +178,15 @@ public class ReactNativeGoogleMobileAdsCommon {
|
|
|
178
178
|
|
|
179
179
|
for (Map.Entry<String, Object> entry : customTargeting.entrySet()) {
|
|
180
180
|
String key = entry.getKey();
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
Object value = entry.getValue();
|
|
182
|
+
|
|
183
|
+
if (value instanceof String) {
|
|
184
|
+
String finalValue = (String) value;
|
|
185
|
+
builder.addCustomTargeting(key, finalValue);
|
|
186
|
+
} else {
|
|
187
|
+
ArrayList finalValue = (ArrayList) value;
|
|
188
|
+
builder.addCustomTargeting(key, finalValue);
|
|
189
|
+
}
|
|
183
190
|
}
|
|
184
191
|
}
|
|
185
192
|
|
package/docs/displaying-ads.mdx
CHANGED
|
@@ -399,18 +399,33 @@ The module exposes a [`BannerAd`](/reference/admob/bannerad) component. The `uni
|
|
|
399
399
|
a banner:
|
|
400
400
|
|
|
401
401
|
```js
|
|
402
|
-
import React from 'react';
|
|
402
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
403
|
+
import { AppState } from 'react-native';
|
|
403
404
|
import { BannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
|
|
404
405
|
|
|
405
406
|
const adUnitId = __DEV__ ? TestIds.ADAPTIVE_BANNER : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
406
407
|
|
|
407
408
|
function App() {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
409
|
+
const appState = useRef(AppState.currentState);
|
|
410
|
+
const [key, setKey] = useState(`banner-${Date.now()}`);
|
|
411
|
+
|
|
412
|
+
// WKWebView can terminate if app is in a "suspended state", resulting in an empty banner when app returns to foreground.
|
|
413
|
+
// A Google Mobile Ads Advisor suggests requesting a new ad when the app is foregrounded.
|
|
414
|
+
// For more details, see: [https://groups.google.com/g/google-admob-ads-sdk/c/rwBpqOUr8m8]
|
|
415
|
+
useEffect(() => {
|
|
416
|
+
const subscription = AppState.addEventListener('change', nextAppState => {
|
|
417
|
+
if (appState.current.match(/background/) && nextAppState === 'active') {
|
|
418
|
+
setKey(`banner-${Date.now()}`);
|
|
419
|
+
}
|
|
420
|
+
appState.current = nextAppState;
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
return () => {
|
|
424
|
+
subscription.remove();
|
|
425
|
+
};
|
|
426
|
+
}, []);
|
|
427
|
+
|
|
428
|
+
return <BannerAd key={key} unitId={adUnitId} size={BannerAdSize.ANCHORED_ADAPTIVE_BANNER} />;
|
|
414
429
|
}
|
|
415
430
|
```
|
|
416
431
|
|
|
@@ -473,12 +488,7 @@ import { GAMBannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-a
|
|
|
473
488
|
const adUnitId = __DEV__ ? TestIds.GAM_BANNER : '/xxx/yyyy';
|
|
474
489
|
|
|
475
490
|
function App() {
|
|
476
|
-
return
|
|
477
|
-
<GAMBannerAd
|
|
478
|
-
unitId={adUnitId}
|
|
479
|
-
sizes={[BannerAdSize.FULL_BANNER]}
|
|
480
|
-
/>
|
|
481
|
-
);
|
|
491
|
+
return <GAMBannerAd unitId={adUnitId} sizes={[BannerAdSize.FULL_BANNER]} />;
|
|
482
492
|
}
|
|
483
493
|
```
|
|
484
494
|
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "13.
|
|
1
|
+
export declare const SDK_VERSION = "13.3.1";
|
|
2
2
|
export { default, MobileAds } from './MobileAds';
|
|
3
3
|
export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
|
|
4
4
|
export { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
@@ -71,10 +71,10 @@ export interface RequestOptions {
|
|
|
71
71
|
/**
|
|
72
72
|
* key-value pairs used for custom targeting
|
|
73
73
|
*
|
|
74
|
-
* Takes an
|
|
74
|
+
* Takes an object of keys with values of string or array of strings.
|
|
75
75
|
*/
|
|
76
76
|
customTargeting?: {
|
|
77
|
-
[key: string]: string;
|
|
77
|
+
[key: string]: string | string[];
|
|
78
78
|
};
|
|
79
79
|
/**
|
|
80
80
|
* Sets the request agent string to identify the ad request's origin. Third party libraries that reference the Mobile
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestOptions.d.ts","sourceRoot":"","sources":["../../../src/types/RequestOptions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,oBAAoB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEpD,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAC;IAExC;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG;QAAE,WAAW,CA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1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "13.
|
|
1
|
+
export declare const version = "13.3.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-google-mobile-ads",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.3.1",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Google Mobile Ads is an easy way to monetize mobile apps with targeted, in-app advertising.",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
@@ -74,9 +74,9 @@ export interface RequestOptions {
|
|
|
74
74
|
/**
|
|
75
75
|
* key-value pairs used for custom targeting
|
|
76
76
|
*
|
|
77
|
-
* Takes an
|
|
77
|
+
* Takes an object of keys with values of string or array of strings.
|
|
78
78
|
*/
|
|
79
|
-
customTargeting?: { [key: string]: string };
|
|
79
|
+
customTargeting?: { [key: string]: string | string[] };
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Sets the request agent string to identify the ad request's origin. Third party libraries that reference the Mobile
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '13.
|
|
2
|
+
export const version = '13.3.1';
|