Skip to content

Commit 58edd09

Browse files
authored
Android 14 support (#7801)
From react native [pr](facebook/react-native#38256) > Summary: > Add RECEIVER_EXPORTED/RECEIVER_NOT_EXPORTED flag support to DevSupportManagerBase for Android 14 change. See > https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported for details. > > Without this fix, app crashes during launch because of : > SecurityException: {package name here}: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
1 parent 570aae5 commit 58edd09

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadHandler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.content.IntentFilter;
88
import android.view.KeyEvent;
99
import android.widget.EditText;
10+
import android.os.Build;
1011

1112
import com.facebook.react.devsupport.interfaces.DevSupportManager;
1213
import com.reactnativenavigation.utils.UiUtils;
@@ -49,7 +50,11 @@ public void removeReloadListener(ReloadListener listener) {
4950
}
5051

5152
public void onActivityResumed(Activity activity) {
52-
activity.registerReceiver(reloadReceiver, new IntentFilter(RELOAD_BROADCAST));
53+
if (Build.VERSION.SDK_INT >= 34 && activity.getApplicationInfo().targetSdkVersion >= 34) {
54+
activity.registerReceiver(reloadReceiver, new IntentFilter(RELOAD_BROADCAST), Context.RECEIVER_EXPORTED);
55+
} else {
56+
activity.registerReceiver(reloadReceiver, new IntentFilter(RELOAD_BROADCAST));
57+
}
5358
}
5459

5560
public void onActivityPaused(Activity activity) {

0 commit comments

Comments
 (0)