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

App crashes when receive notification for some user. #1874

Closed
1 task done
sahil0289 opened this issue Oct 19, 2023 · 7 comments
Closed
1 task done

App crashes when receive notification for some user. #1874

sahil0289 opened this issue Oct 19, 2023 · 7 comments
Assignees

Comments

@sahil0289
Copy link

sahil0289 commented Oct 19, 2023

How can we help?

App crashes whenever user receive notification after implementing one signal SDK - com.onesignal:OneSignal:[5.0.0, 5.99.99]. It is showing error in crashlytics. Caused by: org.json.JSONException: Value 3000 at value of type java.lang.String cannot be converted to boolean
org.json.JSON.typeMismatch(JSON.java:101).
Crashlytics bug is shown below:-

java.lang.RuntimeException: Unable to start receiver com.onesignal.notifications.receivers.FCMBroadcastReceiver: java.lang.reflect.InvocationTargetException
android.app.ActivityThread.handleReceiver(ActivityThread.java:4568)
android.app.ActivityThread.-$$Nest$mhandleReceiver(:0)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2316)
android.os.Handler.dispatchMessage(Handler.java:106)
android.os.Looper.loopOnce(Looper.java:240)
android.os.Looper.loop(Looper.java:351)
android.app.ActivityThread.main(ActivityThread.java:8427)
java.lang.reflect.Method.invoke(Method.java:0)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
Caused by: java.lang.reflect.InvocationTargetException:
java.lang.reflect.Constructor.newInstance0(Constructor.java:0)
java.lang.reflect.Constructor.newInstance(Constructor.java:343)
com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:90)
com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:83)
com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:83)
com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
com.onesignal.common.services.ServiceProvider.getService$com_onesignal_core(ServiceProvider.kt:40)
com.onesignal.internal.OneSignalImp.initWithContext(OneSignalImp.kt:192)
com.onesignal.OneSignal.initWithContext(OneSignal.kt:196)
com.onesignal.notifications.receivers.FCMBroadcastReceiver.onReceive(FCMBroadcastReceiver.kt:24)
android.app.ActivityThread.handleReceiver(ActivityThread.java:4552)
android.app.ActivityThread.-$$Nest$mhandleReceiver(:0)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2316)
android.os.Handler.dispatchMessage(Handler.java:106)
android.os.Looper.loopOnce(Looper.java:240)
android.os.Looper.loop(Looper.java:351)
android.app.ActivityThread.main(ActivityThread.java:8427)
java.lang.reflect.Method.invoke(Method.java:0)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
Caused by: org.json.JSONException: Value 3000 at value of type java.lang.String cannot be converted to boolean
org.json.JSON.typeMismatch(JSON.java:101)
org.json.JSONObject.getBoolean(JSONObject.java:422)
com.onesignal.common.modeling.Model.initializeFromJson(Model.kt:107)
com.onesignal.user.internal.properties.PropertiesModel.createModelForProperty(PropertiesModel.kt:94)
com.onesignal.common.modeling.Model.initializeFromJson(Model.kt:87)
com.onesignal.common.modeling.SimpleModelStore.create(SimpleModelStore.kt:32)
com.onesignal.common.modeling.ModelStore.load(ModelStore.kt:129)
com.onesignal.common.modeling.SimpleModelStore.(SimpleModelStore.kt:25)
com.onesignal.user.internal.properties.PropertiesModelStore.(PropertiesModelStore.kt:8)
java.lang.reflect.Constructor.newInstance0(Constructor.java:0)
java.lang.reflect.Constructor.newInstance(Constructor.java:343)
com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:90)
com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:83)
com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:83)
com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
com.onesignal.common.services.ServiceProvider.getService$com_onesignal_core(ServiceProvider.kt:40)
com.onesignal.internal.OneSignalImp.initWithContext(OneSignalImp.kt:192)
com.onesignal.OneSignal.initWithContext(OneSignal.kt:196)
com.onesignal.notifications.receivers.FCMBroadcastReceiver.onReceive(FCMBroadcastReceiver.kt:24)
android.app.ActivityThread.handleReceiver(ActivityThread.java:4552)
android.app.ActivityThread.-$$Nest$mhandleReceiver(:0)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2316)
android.os.Handler.dispatchMessage(Handler.java:106)
android.os.Looper.loopOnce(Looper.java:240)
android.os.Looper.loop(Looper.java:351)
android.app.ActivityThread.main(ActivityThread.java:8427)
java.lang.reflect.Method.invoke(Method.java:0)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@sahil0289 sahil0289 changed the title App crashes when receive notification. App crashes when receive notification for some user. Oct 19, 2023
@emawby
Copy link
Contributor

emawby commented Oct 19, 2023

@sahil0289 Are you able to reproduce this bug in your app? Could you share some of the content of the notification or any settings your notification is using?

@brismithers
Copy link
Contributor

Hi @sahil0289 I've been able to reproduce this issue. This happens when certain tag names are used that clash with our models, they don't play nicely with our use of reflection during the deserialization process. A fix for this will be created shortly, thanks!

@sahil0289
Copy link
Author

sahil0289 commented Oct 28, 2023 via email

@brismithers
Copy link
Contributor

It's possible the tag is already set on the user and being brought down to the device. I'm seeing the SDK crash trying to deserialize a tag value=3000.

@sahil0289
Copy link
Author

sahil0289 commented Oct 30, 2023 via email

brismithers added a commit that referenced this issue Nov 1, 2023
…ical-method-name

Update PropertiesModel's deserialization of tags to not use `Model.initializeFromJson`
@jennantilla
Copy link
Contributor

@sahil0289 just wanted to check in. We released 5.0.4 last month. Have you had a chance to upgrade to this latest version, and if so, has this solved the issue for you?

@jennantilla
Copy link
Contributor

@sahil0289 Closing out this issue as a fix was added in 5.0.4. If you are still having problems please let us know and we will reopen. Thanks!

jinliu9508 pushed a commit that referenced this issue Jan 31, 2024
…ical-method-name

Update PropertiesModel's deserialization of tags to not use `Model.initializeFromJson`
jinliu9508 pushed a commit that referenced this issue Jan 31, 2024
…ical-method-name

Update PropertiesModel's deserialization of tags to not use `Model.initializeFromJson`
jinliu9508 pushed a commit that referenced this issue Feb 6, 2024
…ical-method-name

Update PropertiesModel's deserialization of tags to not use `Model.initializeFromJson`
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

4 participants