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

Android: Notifee.getInstance() error after app is restarted and running in background #592

Closed
anderpaz opened this issue Nov 19, 2022 · 4 comments · Fixed by #599
Closed
Labels
android bug needs-feedback Waiting on response to questions

Comments

@anderpaz
Copy link

anderpaz commented Nov 19, 2022

I have the following error when the phone is restarted and the application goes up.

java.lang.NullPointerException: Attempt to invoke virtual method 'void app.notifee.core.Notifee.getDisplayedNotifications(app.notifee.core.interfaces.MethodCallResult)' on a null object reference

When method of the NotifeeApiModule class that calls Notifee.getInstance()

React-native: 0.75
@notifee/react-native: 5.7.0

Has anyone had this problem that can help me?

@anderpaz
Copy link
Author

First thing I'm doing in the app is creating a channel and when I restart the app and run a background service I get this error, which is the same reference as the one above

Exception in native call
java.lang.NullPointerException: Attempt to invoke virtual method 'void app.notifee.core.Notifee.createChannel(android.os.Bundle, app.notifee.core.interfaces.MethodCallResult)' on a null object reference
at io.invertase.notifee.NotifeeApiModule.createChannel(NotifeeApiModule.java:102)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
at com.facebook.jni.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:223)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
at java.lang.Thread.run(Thread.java:923)
E Unable to launch redbox because react activity is not available, here is the error that redbox would've displayed: Attempt to invoke virtual method 'void app.notifee.core.Notifee.createChannel(android.os.Bundle, app.notifee.core.interfaces.MethodCallResult)' on a null object reference
E Unable to launch redbox because react activity is not available, here is the error that redbox would've displayed: Attempt to invoke vi

@helenaford
Copy link
Member

Hi there, I've not seen this before but it seems to be trying to create a channel... where do you attempt to create a channel in your app?

There may be something we can do to prevent the exception in the native code Notifee.createChannel, but it does seem weird the react activity isn't available when you try to call createChannel

@helenaford helenaford added needs-feedback Waiting on response to questions android bug labels Nov 24, 2022
@helenaford helenaford changed the title Notifee.getInstance() error after app is restarted and running in background [Android]: Notifee.getInstance() error after app is restarted and running in background Nov 24, 2022
@helenaford helenaford changed the title [Android]: Notifee.getInstance() error after app is restarted and running in background Android: Notifee.getInstance() error after app is restarted and running in background Nov 28, 2022
@helenaford
Copy link
Member

@anderpaz can you please provide some way of reproducing this error? It's not very clear why this could be happening, and like I said above you are the first person to report this.

@helenaford
Copy link
Member

fix to prevent the error is release d in 7.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug needs-feedback Waiting on response to questions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants