pusher / push-notifications-flutter

Official Pusher Beams Flutter client plugin (iOS, Android and Web), receive notifications easily on your Flutter application with Pusher Beams.
https://pub.dev/packages/pusher_beams
MIT License
10 stars 27 forks source link

feat(ios): On Notification Tap events not passed to firebase handlers that handles the notifications that opened the app #23

Open rutvik110 opened 2 years ago

rutvik110 commented 2 years ago

Description :

I'm working on adding foreground and background notifications support in one of my apps. I've got firebase and pusher beams added to support notifications. As of this moment, as pusher beams only has handlers to handle notifications in foreground state with PusherBeams.instance.onMessageReceivedInTheForeground and no support for handling notifications that are opened the app from background or terminated state, so to handle those types of events, I'm using Firebase handler FirebaseMessaging.onMessageOpenedApp.listen to listen to those notifications.

The issue comes when I'm trying to open the app from background/terminated state by tapping on notifications on ios, the firebase handler is never called.

Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called and the following warnings are logged in the console.
Warning: UNUserNotificationCenter delegate received call to -userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: but the completion handler was never called.

In case of android, the handler does gets called properly and I recieve that notification data within the app.

To make sure this wasn't an issue around firebase handlers, I removed all the pusher beams integration and tested the notifications which worked as expected in all app states. I did a little digging in to the pusher beams ios code for notifications, found out this handler here for handling notification taps.

Screenshot 2022-03-22 at 9 09 07 AM

I see that it's yet to be implemented but I still don't understand the reason why the background notifications are properly passed on to the firebase handlers in the android but on ios it fails to do so. Is pusher beams handling that callback but not passing it to firebase handlers!? Could really use some help here as this is a critical part of our app!

benjamin-tang-pusher commented 2 years ago

Unfortunately we won't be able to support handling notifications in the background until it is implemented in the library. I will keep this issue open however, just in case another user is able to come up with a workaround.

gripep commented 5 months ago

Are you still planning to add this feature? Not having it is a big deal, especially as we're considering moving away from Pusher. Is there a timeline for its implementation?

fnoceda commented 3 months ago

Same here, it is a big problem not to manage this type of events, is there a deadline for its implementation?

mahmood541996 commented 1 month ago

@rutvik110 Hi Rutvik, I cloned pusher beams example and noticed that FirebaseMessaging.onMessageOpenedApp doesn't work on Android, but FirebaseMessaging.onBackgroundMessage only works on android.

Can you help me how you get the FirebaseMessaging.onMessageOpenedApp working ?