OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.56k stars 371 forks source link

[Bug]: RNOneSignal.requestNotificationPermission Crash #1647

Open Cjaker opened 5 months ago

Cjaker commented 5 months ago

What happened?

Hello,

On our project we are using OneSignal 5.0.2 and we are having many users (69% of users on Android 6 and 30% of users on Android 5, based on 2.3k~ users) are having crash on the function of title.

If needed I can try bringing more information, I'm available to help.

Steps to reproduce?

Unfortunately, we don't have steps to reproduce yet, we are working on it.

What did you expect to happen?

Should request permissions without causing an exception.

React Native OneSignal SDK version

Release 5.0.2

Which platform(s) are affected?

Relevant log output

`java.lang.NoClassDefFoundError - com.onesignal.rnonesignalandroid.RNOneSignal$$ExternalSyntheticLambda0`

Fatal Exception: java.lang.RuntimeException: Could not invoke OneSignal.requestNotificationPermission
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:383)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
       at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:815)
       at android.os.Handler.dispatchMessage(Handler.java:104)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
       at android.os.Looper.loop(Looper.java:238)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
       at java.lang.Thread.run(Thread.java:818)


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
tandonpushkar commented 5 months ago

+1 Any solution?

MicaelaWaigel commented 5 months ago

+1 Any solution?

Hi! We were having a similar problem, and our solution was to migrate the permissions request to react-native-permissions and initialize OneSignal once the user acepts them. So far we have no problems in this way.

I hope it helps!

uasghar-smile commented 4 months ago

+1 Any update from OneSignal officials?

jfishman1 commented 2 months ago

Looks like we fixed this in RN SDK version 5.0.3 https://github.com/OneSignal/react-native-onesignal/releases/tag/5.0.3

Please upgrade and if you still have issues, you can follow this guide to get a log and share it here or with support@onesignal.com

https://documentation.onesignal.com/docs/capturing-a-debug-log

Thanks!

ajouve commented 1 month ago

Still have the error on RN SDK version 5.1.2