-
Notifications
You must be signed in to change notification settings - Fork 371
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]: onNotificationReceived() not called #2194
Comments
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
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 |
@faisal-kabir @simon1867 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 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
The text was updated successfully, but these errors were encountered: