Skip to content

onPushNotificationReceived not getting called when Android App is in Background/Terminated State #247

@himu243

Description

@himu243

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

NotificationListner

AndroidManifest

MainActivity

Setup (please complete the following information):

  • OS: Android 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions