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

[Bug]: Unable to start receiver com.onesignal.notifications.receivers.FCMBroadcastReceiver: java.lang.NullPointerException #706

Closed
1 task done
ajaybirla-fabzen opened this issue Mar 8, 2024 · 1 comment

Comments

@ajaybirla-fabzen
Copy link

What happened?

The application crashes whenever it receives a notification when it is in the background.

Steps to reproduce?

1. Launch the application.
2. Minimize the application.
3. Send a notification to the application.
4. Click on the notification.
5. Observe the application crash.

What did you expect to happen?

I expect the app to not crash whenever it receives a notification in the background.

Unity version

2021.3.17f1

OneSignal Unity SDK version

5.0.6

Platform

Android

Relevant log output

Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.onesignal.notifications.receivers.FCMBroadcastReceiver: java.lang.NullPointerException
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:4111)
       at android.app.ActivityThread.access$1700(ActivityThread.java:242)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2078)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:227)
       at android.app.ActivityThread.main(ActivityThread.java:7822)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1026)

Caused by java.lang.NullPointerException:
       at com.onesignal.core.internal.application.impl.ApplicationService.getAppContext(ApplicationService.kt:40)
       at com.onesignal.core.internal.device.impl.DeviceService.packageInstalledAndEnabled(DeviceService.kt:106)
       at com.onesignal.core.internal.device.impl.DeviceService.isGMSInstalledAndEnabled(DeviceService.kt:101)
       at com.onesignal.core.internal.device.impl.DeviceService.supportsGooglePush(DeviceService.kt:84)
       at com.onesignal.core.internal.device.impl.DeviceService.getDeviceType(DeviceService.kt:41)
       at com.onesignal.core.internal.device.impl.DeviceService.isAndroidDeviceType(DeviceService.kt:18)
       at com.onesignal.location.LocationModule$register$1.invoke(LocationModule.kt:31)
       at com.onesignal.location.LocationModule$register$1.invoke(LocationModule.kt:28)
       at com.onesignal.common.services.ServiceRegistrationLambda.resolve(ServiceRegistration.kt:164)
       at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
       at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
       at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:82)
       at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
       at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
       at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:82)
       at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
       at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
       at com.onesignal.internal.OneSignalImp.initWithContext(OneSignalImp.kt:518)
       at com.onesignal.OneSignal.initWithContext(OneSignal.kt:208)
       at com.onesignal.notifications.receivers.FCMBroadcastReceiver.onReceive(FCMBroadcastReceiver.kt:26)
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:4095)
       at android.app.ActivityThread.access$1700(ActivityThread.java:242)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2078)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:227)
       at android.app.ActivityThread.main(ActivityThread.java:7822)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1026)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@shepherd-l
Copy link
Contributor

Thanks for reporting, this should be fixed in the latest Unity SDK 5.1.1 Release. Feel free to tag me if you are still seeing this 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