react-native-google-mobile-ads 14.4.1 → 14.4.3
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/README.md +15 -10
- package/android/src/main/AndroidManifest.xml +22 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt +6 -1
- package/docs/displaying-ads.mdx +20 -3
- 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/README.md
CHANGED
|
@@ -31,19 +31,24 @@ React Native Google Mobile Ads is built with three key principals in mind;
|
|
|
31
31
|
- full reference & installation documentation alongside detailed guides and FAQs
|
|
32
32
|
|
|
33
33
|
## Migrating to the New Architecture Status (backwards compatible)
|
|
34
|
+
|
|
34
35
|
This package can be used in both The Old and [The New Architecture](https://reactnative.dev/docs/the-new-architecture/landing-page).
|
|
35
36
|
When using The New Architecture, some legacy code will still be used though. See status below:
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
| Platform | Feature | Status |
|
|
39
|
+
| -------- | ------------------------------------------------- | ----------- |
|
|
40
|
+
| iOS | Mobile Ads SDK Methods (Turbo Native Module) | ✅ Complete |
|
|
41
|
+
| iOS | Banners (Fabric Native Component) | ✅ Complete |
|
|
42
|
+
| iOS | Full Screen Ads (Turbo Native Module) | ⏳ To-Do |
|
|
43
|
+
| iOS | User Messaging Platform (Turbo Native Module) | ⏳ To-Do |
|
|
44
|
+
| iOS | EventEmitter (Turbo Native Module) | ⏳ To-Do |
|
|
45
|
+
| iOS | Revenue Precision Constants (Turbo Native Module) | ⏳ To-Do |
|
|
46
|
+
| Android | Mobile Ads SDK Methods (Turbo Native Module) | ⏳ To-Do |
|
|
47
|
+
| Android | Banners (Fabric Native Component) | ⏳ To-Do |
|
|
48
|
+
| Android | Full Screen Ads (Turbo Native Module) | ⏳ To-Do |
|
|
49
|
+
| Android | User Messaging Platform (Turbo Native Module) | ⏳ To-Do |
|
|
50
|
+
| Android | EventEmitter (Turbo Native Module) | ⏳ To-Do |
|
|
51
|
+
| Android | Revenue Precision Constants (Turbo Native Module) | ⏳ To-Do |
|
|
47
52
|
|
|
48
53
|
## Documentation
|
|
49
54
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:tools="http://schemas.android.com/tools"
|
|
3
4
|
package="io.invertase.googlemobileads">
|
|
4
5
|
|
|
5
6
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
@@ -19,5 +20,26 @@
|
|
|
19
20
|
<meta-data
|
|
20
21
|
android:name="com.google.android.gms.ads.flag.OPTIMIZE_AD_LOADING"
|
|
21
22
|
android:value="${appJSONGoogleMobileAdsOptimizeAdLoading}"/>
|
|
23
|
+
|
|
24
|
+
<!-- This may generate a warning during your build:
|
|
25
|
+
|
|
26
|
+
> property#android.adservices.AD_SERVICES_CONFIG@android:resource
|
|
27
|
+
> was tagged at AndroidManifest.xml:23 to replace other declarations
|
|
28
|
+
> but no other declaration present
|
|
29
|
+
|
|
30
|
+
You may safely ignore this warning.
|
|
31
|
+
|
|
32
|
+
We must include this in case you also use Firebase Analytics in some
|
|
33
|
+
of its configurations, as it may also include this file, and the two
|
|
34
|
+
will collide and cause a build error if we don't set this one to take
|
|
35
|
+
priority via replacement.
|
|
36
|
+
|
|
37
|
+
https://github.com/invertase/react-native-google-mobile-ads/issues/657
|
|
38
|
+
|
|
39
|
+
-->
|
|
40
|
+
<property
|
|
41
|
+
android:name="android.adservices.AD_SERVICES_CONFIG"
|
|
42
|
+
android:resource="@xml/gma_ad_services_config"
|
|
43
|
+
tools:replace="android:resource" />
|
|
22
44
|
</application>
|
|
23
45
|
</manifest>
|
package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt
CHANGED
|
@@ -95,7 +95,12 @@ class ReactNativeGoogleMobileAdsModule(
|
|
|
95
95
|
@ReactMethod
|
|
96
96
|
fun initialize(promise: Promise) {
|
|
97
97
|
MobileAds.initialize(
|
|
98
|
-
|
|
98
|
+
// in react-native, the Activity instance *may* go away, becoming null after initialize
|
|
99
|
+
// it is not clear if that can happen here without an initialize necessarily following the Activity lifecycle
|
|
100
|
+
// it is not clear if that will cause problems even if it happens, but users that have widely deployed this
|
|
101
|
+
// with the use of currentActivity have not seen problems
|
|
102
|
+
// reference if it needs attention: https://github.com/invertase/react-native-google-mobile-ads/pull/664
|
|
103
|
+
currentActivity ?: reactApplicationContext,
|
|
99
104
|
OnInitializationCompleteListener { initializationStatus ->
|
|
100
105
|
val result = Arguments.createArray()
|
|
101
106
|
for ((key, value) in initializationStatus.adapterStatusMap) {
|
package/docs/displaying-ads.mdx
CHANGED
|
@@ -91,7 +91,7 @@ To listen to events, such as when the advert from the network has loaded or when
|
|
|
91
91
|
|
|
92
92
|
```jsx
|
|
93
93
|
import React, { useEffect, useState } from 'react';
|
|
94
|
-
import { Button } from 'react-native';
|
|
94
|
+
import { Button, Platform, StatusBar } from 'react-native';
|
|
95
95
|
import { InterstitialAd, AdEventType, TestIds } from 'react-native-google-mobile-ads';
|
|
96
96
|
|
|
97
97
|
const adUnitId = __DEV__ ? TestIds.INTERSTITIAL : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
@@ -104,15 +104,32 @@ function App() {
|
|
|
104
104
|
const [loaded, setLoaded] = useState(false);
|
|
105
105
|
|
|
106
106
|
useEffect(() => {
|
|
107
|
-
const
|
|
107
|
+
const unsubscribeLoaded = interstitial.addAdEventListener(AdEventType.LOADED, () => {
|
|
108
108
|
setLoaded(true);
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
+
const unsubscribeOpened = interstitial.addAdEventListener(AdEventType.OPENED, () => {
|
|
112
|
+
if (Platform.OS === 'ios') {
|
|
113
|
+
// Prevent the close button from being unreachable by hiding the status bar on iOS
|
|
114
|
+
StatusBar.setHidden(true)
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const unsubscribeClosed = interstitial.addAdEventListener(AdEventType.CLOSED, () => {
|
|
119
|
+
if (Platform.OS === 'ios') {
|
|
120
|
+
StatusBar.setHidden(false)
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
111
124
|
// Start loading the interstitial straight away
|
|
112
125
|
interstitial.load();
|
|
113
126
|
|
|
114
127
|
// Unsubscribe from events on unmount
|
|
115
|
-
return
|
|
128
|
+
return () => {
|
|
129
|
+
unsubscribeLoaded();
|
|
130
|
+
unsubscribeOpened();
|
|
131
|
+
unsubscribeClosed();
|
|
132
|
+
};
|
|
116
133
|
}, []);
|
|
117
134
|
|
|
118
135
|
// No advert ready to show yet
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "14.4.
|
|
1
|
+
export declare const SDK_VERSION = "14.4.3";
|
|
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.4.
|
|
1
|
+
export declare const version = "14.4.3";
|
|
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.4.
|
|
3
|
+
"version": "14.4.3",
|
|
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.4.
|
|
2
|
+
export const version = '14.4.3';
|