Closed himadri1266 closed 1 month ago
I am having the same problem, "onNotificationReceived" method is not called in the background.
Hello @himadri1266 @faisal-kabir, were you able to actually see the notification on your device after you send it from the dashboard? Are you able to check the subscribed status in debug and/or the dashboard?
Hi @jinliu9508
Hello @himadri1266 @faisal-kabir, were you able to actually see the notification on your device after you send it from the dashboard? Are you able to check the subscribed status in debug and/or the dashboard?
Yes, Everything is showing properly on the OneSignal Dashboard, and the status is subscribed. I am able to receive notifications when the app is in the foreground, but notifications do not come when the app is in the background.
I haven't updated to version 5 yet because onNotificationReceived()
never gets called. Everything works great using 4.8.10
. But when I update to 5.x.x
I stop getting notifications.
@faisal-kabir @simon1867
I am unable to reproduce this issue as the notification works for me regardless whether my app is active or killed. I think it might be a setup issue. A few things that you might want to pay attention to when you setup the service extension following this documentation is that make sure the @keep
tag is added and the manifest class value is fully name spaced.
You may share how you setup the service extension and I will be glad to help!
@himadri1266 I think your NotificationServiceClass is missing a '@keep' annotation. Can you try adding it and let me know how that works out for you?
Wow, well it's working for me now. I pulled in the latest version 5.1.23
and I added the @keep
annotation to my service extension class.
Thanks @jinliu9508
Closing this issue as it looks like a setup issue. A few things that anyone might want to pay extra attention to when you setup the service extension following this documentation is that make sure the @keep tag is added and the manifest class value is fully name spaced. If this is still an issue, please open a new report with updated information.
What happened?
I am unable to detect notifications in the
onNotificationReceived()
method ofINotificationServiceExtension
. This issue occurs whether the app is in the background or foreground. I am using the latest version of the OneSignal SDK, version "5.1.21".Below is the code I have integrated:
1. build.gradle (app level):
implementation("com.onesignal:OneSignal:5.1.21")
2. AndroidManifest.xml:
3. NotificationService class:
Steps to reproduce?
What did you expect to happen?
Whenever a notification arrives on the mobile device, the onNotificationReceived() method will be executed and will handle the API call from within that method.
OneSignal Android SDK version
5.1.21
Android version
15, 14, 13, 12
Specific Android models
No response
Relevant log output
No response
Code of Conduct