You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The latest OneSignal RN SDK v5.1.0 causes a RuntimeException and crashes the app when calling getPermissionAsync() in some Android devices according to our Sentry and Google Play crash analytics. Stack trace that's posted below suggests initWithContext is the culprit, but I'm sure we followed the OneSignal SDK setup thoroughly, and definitely call OneSignal.initialize with our appId on app startup. Interestingly, I cannot reproduce this crash on my physical OnePlus 8T device or Android 13 emulator, but some of my colleagues can, e.g. with Samsung Galaxy A14.
Not sure about iOS.
Steps to reproduce?
Not sure how to reproduce, happens on some Android devices, e.g. Samsung Galaxy A14, Galaxy Tab A7, Galaxy A03, Moto E22, Galaxy A01, Redmi Note 8 and a lot others.
What did you expect to happen?
I expect the app to not crash when OneSignal.getPermissionAsync() is called.
React Native OneSignal SDK version
Release 5.1.0
Which platform(s) are affected?
iOS
Android
Relevant log output
java.lang.Exception: Must call 'initWithContext' before use
at com.onesignal.internal.OneSignalImp.getNotifications(OneSignalImp.kt:96)
at com.onesignal.OneSignal.getNotifications(OneSignal.kt:62)
at com.onesignal.rnonesignalandroid.RNOneSignal.hasNotificationPermission(RNOneSignal.java:460)
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:149)
at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:234)
at java.lang.Thread.run(Thread.java:1012)
java.lang.reflect.InvocationTargetException: null
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:149)
at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:234)
at java.lang.Thread.run(Thread.java:1012)
java.lang.RuntimeException: Could not invoke OneSignal.hasNotificationPermission
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:381)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:149)
at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:234)
at java.lang.Thread.run(Thread.java:1012)
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
I changed the initialize parameter from OneSignal.initialize(Constants.expoConfig.extra.oneSignalAppId) to OneSignal.initialize(process.env.EXPO_PUBLIC_ONE_SIGNAL_APP_ID) and the error disappeared.
What happened?
The latest OneSignal RN SDK v5.1.0 causes a RuntimeException and crashes the app when calling
getPermissionAsync()
in some Android devices according to our Sentry and Google Play crash analytics. Stack trace that's posted below suggestsinitWithContext
is the culprit, but I'm sure we followed the OneSignal SDK setup thoroughly, and definitely callOneSignal.initialize
with ourappId
on app startup. Interestingly, I cannot reproduce this crash on my physical OnePlus 8T device or Android 13 emulator, but some of my colleagues can, e.g. with Samsung Galaxy A14.Not sure about iOS.
Steps to reproduce?
What did you expect to happen?
I expect the app to not crash when
OneSignal.getPermissionAsync()
is called.React Native OneSignal SDK version
Release 5.1.0
Which platform(s) are affected?
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: