0

According to FCM official documentation:

On iOS, if the user swipes away the application from app Switcher, it must be manually reopened again for background messages to start working again

See: https://firebase.flutter.dev/docs/messaging/usage/

However, any app with notifications that I can think of (Whatsapp, Facebook messenger, Tinder etc) will still notify the user if there's a new message, even if the app was swiped away. A different behavior will be a very bad UX (as a sidenote, background messages don't work on FCM ->APN -> client if the physical iPhone was restarted, see https://github.com/FirebaseExtended/flutterfire/issues/7785)

So FCM isn't the right way for iOS. I thought that APN might be the right way, but to my surprise, all of the APN packages seem to be dead (for example see https://pub.dev/packages/flutter_apns - was last pushed 6 months ago and authors stopped responding to issues).

Flutter is a popular framework which exists for years now, so there must be a way to implement notifications properly. What is that way?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
yoni keren
  • 300
  • 2
  • 14
  • In iOS remote push notifications always managed via APNS. So even you use firebase Or any other push notifications services. Firebase is also correct option for integrate remote push notifications. You can also use one signal Notifications. – Vishal Zaveri Jan 08 '22 at 09:34
  • @VishalZaveri Given that background messages won't work if the user swipes away the app, unlike the expected behavior (think of WhatsApp), how is this correct? At best, we can set the notification field in the server, but then the client doesn't have any control of how the notification will look like. Again unlike whatsapp. – yoni keren Jan 08 '22 at 09:39
  • You can manage manage push notifications fire via API backend or socket service . Even App is closed / killed or not in apps switcher. You can also received notifications even in app background. – Vishal Zaveri Jan 08 '22 at 09:53
  • @VishalZaveri There's no way to keep a websocket connection alive if the app is killed. I don't know what you meant by "API backend", but AFAIK can't keep a connection to the server if the app is killed. Also I still don't know why you said that FCM is correct given its limitations. – yoni keren Jan 08 '22 at 10:24
  • Yes, you are right after the app kills scoket connection is not alive. but You can send notifications via firebase push API with device token even app is killed but we can't re-open the app directly when any notification is received. – Vishal Zaveri Feb 26 '22 at 06:51

0 Answers0