Azure / Azure/azure-notificationhubs-android
onPushNotificationReceived not getting called when Android App is in Background/Terminated State
- Dominant language
- Java
- Stars
- 33
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When Android App is in **Foreground** State, **onPushNotificationReceived** listener is getting invoked having the notification data. When in **Background** or **Terminated** State, Notification does get received but **onPushNotificationReceived** listener is not getting invoked neither automatically nor when I tap on the notification. I'm sending the push from Azure Portal.
{
"notification":{
"title":"Notification Hub Test Notification",
"body":"This is a sample notification delivered by Azure Notification Hubs."
},
"data":{
"property1":"value1",
"property2":53
},
"priority": "high"
}
I'm following **Tutorial: Send push notifications to Android devices using Firebase SDK version 1.0.0-preview1 (Current SDK)** tutorial.
https://docs.microsoft.com/en-us/azure/notification-hubs/android-sdk
Is there something else which i need to do apart from the mentioned steps in the above link?
***Exception or Stack Trace***
Add the exception log and stack trace if available
**To Reproduce**
Steps to reproduce the behavior:
***Code Snippet***
Add the code snippet that causes the issue.
**Expected behavior**
It is expected **onPushNotificationReceived** is triggered in Background/Terminated State of Android app when it receive notification.
**Screenshots**

**Setup (please complete the following information):**
- OS: Android 11
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the onPushNotificationReceived listener and the AndroidManifest and MainActivity shown in the screenshots. Reproduce on Android 11 using the linked Firebase SDK 1.0.0-preview1 tutorial and the supplied notification payload, comparing foreground, background, terminated, and notification-tap behavior. Done means the behavior is verified and documented or corrected for each state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, firebase, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100