-
Notifications
You must be signed in to change notification settings - Fork 23
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
OnPushNotificationReceived method not hit when app in background #58
Comments
Update, I read in another closed issue that if the app is in the background, and the notification is clicked in the task tray, the intent should have the data payload as extras in the intent. However this is not working. My extras is always null, in OnNewIntent and OnCreate.
|
Hello, can you try these two methods in your Azure Listener Class: `void INotificationListener.OnPushNotificationReceived(Context context, INotificationMessage message)
`private void SendLocalNotification(Context context, string messageBody, string title, long serialNumber)
And then in MainActivity set the 'Launch Mode' to 'LaunchMode.SingleTop' and add this method in the class:
Also, I use a data only push notification: Hope this helps. |
Can you also share how you are creating your push notification channel, even though the documentation doesn't say you have to, I have found myself creating it manually or else the notification doesn't appear in the tray at all. |
Thanks Melissa, I have sorted out the Android side of things. You have to do data only object in the notification to be able to intercept it in the background as well. As for iOS, I'm receiving when app is in foreground, but not in background. Are you able to intercept in background? Also can you share how you display the notifications in iOS? Thanks |
No worries, are you able to receive push notifications on Android when the app has been swiped closed? This is something I cannot get to work at all. On iOS make sure you have the background modes enabled: Remote notifications and background processing. Also make sure you are sending notifications like this : |
Hi Melissa, Thank you. I got it working now. It's something in that payload that causes background notifications to work. One thing though, when in background mode, it displays the notification separate and in parallel also goes into DidReceivePushNotification override. Is that expected or have you figured something out there? I have not looked into notifications not working when swiped closed. Will let you know when I do... |
Glad you got sorted. I think that is the expected behaviour. no worries, thank you! |
Hello, when my android app is in background, the OnPushNotificationReceived method is never hit. I am receiving the notification, and it's displayed in task tray using the default notification channel. However we need to be able to intercept the notification data for further processing.
I'm am using the latest version of everything.
Windows 10
Visual Studio
The text was updated successfully, but these errors were encountered: