Skip to content
New issue

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

Crash in broadcast receiver #20

Open
MartinPavlik opened this issue May 15, 2022 · 1 comment
Open

Crash in broadcast receiver #20

MartinPavlik opened this issue May 15, 2022 · 1 comment

Comments

@MartinPavlik
Copy link

Hi,

I was inspecting adb logs and found this crash, RN complains about Tried to access a JS module before the React instance was fully set up. Calls to ReactContext#getJSModule should only happen once initialize() has been called on your native module..

05-15 08:20:48.725  4058  4058 E AndroidRuntime: FATAL EXCEPTION: main
05-15 08:20:48.725  4058  4058 E AndroidRuntime: Process: com.screenmanager, PID: 4058
05-15 08:20:48.725  4058  4058 E AndroidRuntime: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.TIME_SET flg=0x25200010 } in com.reactnativemidnight.MidnightModule$midnightBroadcastReceiver$1@23916ad
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1401)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:873)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:99)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:193)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6680)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: Caused by: java.lang.RuntimeException: Tried to access a JS module before the React instance was fully set up. Calls to ReactContext#getJSModule should only happen once initialize() has been called on your native module.
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at com.facebook.react.bridge.ReactContext.getJSModule(ReactContext.java:127)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at com.reactnativemidnight.MidnightModule.sendDayChangedEvent(MidnightModule.kt:28)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at com.reactnativemidnight.MidnightModule.access$sendDayChangedEvent(MidnightModule.kt:15)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at com.reactnativemidnight.MidnightModule$midnightBroadcastReceiver$1.onReceive(MidnightModule.kt:37)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1391)
05-15 08:20:48.725  4058  4058 E AndroidRuntime: 	... 8 more

Any idea what is wrong?

Versions:

"react-native": "0.62.2",
"react-native-midnight": "^1.0.2",
@donovanhiland
Copy link
Contributor

Hi thanks for the report and sorry for the very late response. Are you still experiencing this issue? If you could provide a minimal repro case that would be very helpful in debugging the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants