Skip to content

Commit 1f85c94

Browse files
committed
[Android] Use RECEIVER_NOT_EXPORTED with OrientationConfigListener
1 parent 22a8900 commit 1f85c94

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

android/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,5 @@ dependencies {
5454
implementation "com.facebook.react:react-native:+"
5555
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$_kotlinVersion"
5656
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$_kotlinCoroutinesVersion"
57+
implementation "androidx.core:core-ktx:1.12.0"
5758
}

android/src/main/java/com/github/yamill/orientation/listeners/OrientationConfigListener.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.content.Context
66
import android.content.Intent
77
import android.content.IntentFilter
88
import android.content.res.Configuration
9+
import androidx.core.content.ContextCompat
910
import com.facebook.common.logging.FLog
1011
import com.facebook.react.bridge.Arguments
1112
import com.facebook.react.bridge.LifecycleEventListener
@@ -29,7 +30,7 @@ class OrientationConfigListener internal constructor(
2930
override fun onHostResume() {
3031
val activity = onGetCurrentActivity()
3132
if (activity != null) {
32-
activity.registerReceiver(receiver, IntentFilter(INTENT_ACTION_CONFIG_CHANGED))
33+
ContextCompat.registerReceiver(activity, receiver, IntentFilter(INTENT_ACTION_CONFIG_CHANGED), ContextCompat.RECEIVER_NOT_EXPORTED)
3334
} else {
3435
FLog.e(ReactConstants.TAG, "no activity to register receiver")
3536
}

0 commit comments

Comments
 (0)