4

I am trying to implement custom ui for push notifications in android (title, body, image loaded from url),

the firebase_messaging dart plugin has a limitation for receiving data notifications when the app is killed.

using data payload instead of notifications payload is the option to draw custom ui notifications in android natively.

Is there a way to receive data notifications in flutter when the app is killed ?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Caroline
  • 63
  • 1
  • 6

1 Answers1

4

You can write a background message handler in headless function and use firebase local notification plugin to show the notification

this tutorial will definitely help you
https://medium.com/@sylvainduch/firebase-messaging-catch-them-all-3f9c594734d7

Rashid Abdulla
  • 295
  • 2
  • 10
  • I have implemented your solution which worked in android but not in iOS. When iOS app is killed or terminated, onBackgroundMessage, onResume not called. Do you know any solution? – Sachin Tanpure Oct 09 '20 at 11:24
  • 1
    i don't think this is possible in iOS – Caroline Jan 11 '21 at 16:07
  • It is possible in iOS. You need to register for remote notification and background receive under app capabilities in the iOS build settings. – Surya Oct 18 '22 at 14:56