We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
[email protected]
Here is the diff that solved my problem:
diff --git a/node_modules/react-native-orientation-locker/android/src/main/java/org/wonday/orientation/OrientationModule.java b/node_modules/react-native-orientation-locker/android/src/main/java/org/wonday/orientation/OrientationModule.java index 4a44ff6..7842baf 100644 --- a/node_modules/react-native-orientation-locker/android/src/main/java/org/wonday/orientation/OrientationModule.java +++ b/node_modules/react-native-orientation-locker/android/src/main/java/org/wonday/orientation/OrientationModule.java @@ -16,6 +16,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.hardware.SensorManager; +import android.os.Build; import android.view.Display; import android.view.OrientationEventListener; import android.view.Surface; @@ -59,7 +60,6 @@ public class OrientationModule extends ReactContextBaseJavaModule implements Ori String deviceOrientationValue = lastDeviceOrientationValue; - if (orientation == -1) { deviceOrientationValue = "UNKNOWN"; } else if (orientation > 355 || orientation < 5) { @@ -349,11 +349,20 @@ public class OrientationModule extends ReactContextBaseJavaModule implements Ori return constants; } + // Add this method to handle receiver registration with Android 14 compatibility + private void compatRegisterReceiver(Context context, BroadcastReceiver receiver, IntentFilter filter, boolean exported) { + if (Build.VERSION.SDK_INT >= 34 && context.getApplicationInfo().targetSdkVersion >= 34) { + context.registerReceiver(receiver, filter, exported ? Context.RECEIVER_EXPORTED : Context.RECEIVER_NOT_EXPORTED); + } else { + context.registerReceiver(receiver, filter); + } + } + @Override public void start() { FLog.i(ReactConstants.TAG, "orientation detect enabled."); mOrientationListener.enable(); - ctx.registerReceiver(mReceiver, new IntentFilter("onConfigurationChanged")); + compatRegisterReceiver(ctx, mReceiver, new IntentFilter("onConfigurationChanged"), false); } @Override
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: