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

Foreground notification & default notification as app name not working on Android #25

Closed gtu-myowin closed 2 years ago

gtu-myowin commented 2 years ago

I have two questions

  1. With this package I can show notification when my app is in background. I still want to show the notification while app is in foreground. How can I do that? Now, I am showing the message with snack bar while app is in foreground. How can I show it as notification?
  2. On iOS, it shows app name as notification title if the event title is missing but on Android, it is show blank. How can I set app name as default title?
fbenevides commented 2 years ago

Hi @gtu-myowin,

I imagine you're using onMessageReceivedInTheForeground function to handle this notification. However, I'm afraid it's not possible to show as a normal notification, I guess, due to OS limitations. But I'd love to hear the use case and maybe I can help with that.

About the second question, could you please share a screenshot of this notification? I don't think I got your question. Are you saying that it's always showing the OS as the notification title on iOS?

gtu-myowin commented 2 years ago
  1. Ok, I will show it as in-app notification.

  2. What I mean is

If I send the notification from Beams' debug console (without the title) like this

Screen Shot 2022-07-01 at 1 17 53 PM

on iOS, it shows as below. But on Android, the part I bordered with red is missing. Just a blank there. I hope you get my point this time.

IMG_2498

benjamin-tang-pusher commented 2 years ago

The title is showing in my beams flutter app if I publish a notification without a title. Its possible your notification handling has somehow affected the android notification's title (although iOS app name shows fine). If you temporarily disable it, does the app name reappear? Screenshot 2022-07-06 at 13 42 46

gtu-myowin commented 2 years ago

@benjamin-tang-pusher Thank you for your reply. I believe the background notification is handled by the "pusher_beams" package. I did not put my hands there. I install the package, learnt the example app and adapt it to my app.

I will check the example app on my phone again. Thank you.

benjamin-tang-pusher commented 2 years ago

If your title still isn't showing the app name in the notification, please paste the code here, otherwise I will close this ticket.