2

I was working with flutter and I managed to implement FCM push notification in the app. The FLUTTER_NOTIFICATION_CLICK click_action works fine. But, I need to perform that similar action when the app is launched by clicking the app icon. Is there any method to do so?

Ultimate goal is to perform similar action when the app is launched by clicking the notification or by the app icon (from the app drawer). Please help me with this.

bonyem
  • 1,148
  • 11
  • 20
evolving_kid
  • 293
  • 1
  • 2
  • 8

2 Answers2

1

If you click and launch from notification You can listen that 'onLaunch' method in firebaseMessaging.configure But from 'app icon' is no way as far as I know.

Taz
  • 1,737
  • 1
  • 15
  • 30
  • Yeah. I think you are are right. Is there a method to dismiss those notifications in the status bar when app is opened using app icon? – evolving_kid May 29 '20 at 06:30
1

As far as I know, there is no way to get the received notification content when the app is opened using app icon in Flutter. I tried to find a method, but as of now, I am at zero.

Flutter with FCM supports only onLaunch and onResume click_action events for notifications. If you are able to write some native code, I think you may be able to do this. A simple work around I can give is that :

  1. You can clear the notifications as soon as the app is opened using NotificationManager in Android. Here is the reference.
  2. After that you can fetch the actual notification messages from your server(if there is one) and show it to the user.

This is not an accurate answer. But this is what I finally did. Not sure if this helps.

bonyem
  • 1,148
  • 11
  • 20