Skip to content

Commit 697e809

Browse files
committed
fix: support of react-native 0.81 for Android
1 parent b7d7c99 commit 697e809

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class ReactNativeGoogleMobileAdsModule(
111111
// it is not clear if that will cause problems even if it happens, but users that have widely deployed this
112112
// with the use of currentActivity have not seen problems
113113
// reference if it needs attention: https://github.com/invertase/react-native-google-mobile-ads/pull/664
114-
currentActivity ?: reactApplicationContext,
114+
reactApplicationContext.currentActivity ?: reactApplicationContext,
115115
OnInitializationCompleteListener { initializationStatus ->
116116
val result = Arguments.createArray()
117117
for ((key, value) in initializationStatus.adapterStatusMap) {
@@ -136,7 +136,7 @@ class ReactNativeGoogleMobileAdsModule(
136136

137137
@ReactMethod
138138
fun openAdInspector(promise: Promise) {
139-
val activity = currentActivity
139+
val activity = reactApplicationContext.currentActivity
140140
if (activity == null) {
141141
promise.reject("null-activity", "Ad Inspector attempted to open but the current Activity was null.")
142142
return
@@ -164,8 +164,8 @@ class ReactNativeGoogleMobileAdsModule(
164164

165165
@ReactMethod
166166
fun openDebugMenu(adUnit: String) {
167-
currentActivity?.runOnUiThread {
168-
MobileAds.openDebugMenu(currentActivity!!, adUnit)
167+
reactApplicationContext.currentActivity?.runOnUiThread {
168+
MobileAds.openDebugMenu(reactApplicationContext.currentActivity!!, adUnit)
169169
}
170170
}
171171

0 commit comments

Comments
 (0)