How to setup Push Notifications with Flutter without Firebase and with own custom backend
Asked Answered
S

1

18

I have been developing an App with react native and i am now looking at rebuilding the App using Flutter. Before i start on a rebuild i was researching the functionality of Flutter and seeing if it would be right for our project. I have struggled a bit on plugins for Push Notifications. There is quite a bit of information online for using the Firebase Cloud Messaging to send push notifications to a Flutter App using the Firebase Messaging plugin in the App but i have not found any good articles on setting up Push notifications with your own custom back end.

We already have a custom Node JS backend that serves Push notifications to apple and googles push messaging system so i don't want to start to rely on firebase cloud messaging which will just complicate our systems.

Does anyone know if and how Push notifications can be setup with a Flutter app but using your own custom Node JS backend and not using firebase cloud messaging?

Semblance answered 7/4, 2019 at 9:17 Comment(2)
Have you been able to figure it out? I'm also seeking an answer.Unfeigned
Not sure about Flutter and node.js, but this has been explored on other platforms, so that could give you a hint on how to do this in Flutter. See #51921831, #44570747, or #48948810Reach
P
7

First to answer the question want to ask something.

  1. do you know how push notification works overall?
  2. And how backend notify mobile that something is changed?

To start with firebase works like this:

When backend fires push notification to the firebase server firebase sends a message on the XMPP server which is actively connected via google play services and the same goes for the apple APNs server.

Now when google play service will have this message it will contain the bundle id and something to identify which app to send. And that's why we register broadcast in android app manifest file. Just think about it broadcast do not get called without any send broadcast invoke and if you're not invoking the function then who does?

That part has been handled by the google play service to fire up your broadcast and let you know what push notifications you have received.

so my answer will be no do not use your backend to fire push notification because you need to then use your own XMPP server and let your app connected with a high priority which is currently impossible without showing the notification that you're doing something in the background (i.e. at least for android, ios will not remain in the background after 15min but you can extend by overriding some methods but still if apple reports you, you will not get chance to make app production ready.)

So for android either it's google services or any other services like say for and example azure notification still needs GCM token and key so you might want to reconsider what you are thinking at the moment.

Persist answered 6/5, 2020 at 6:2 Comment(2)
How realtime chat apps handle this? They do not show a notification that they're running in the backgroundHolguin
That is not push notification, that is XMPP chat. check quickblox or firebase xmpp chat server. don't rely on push notification chat, I have done that mistake in my previous company and it was horrible. some time push comes sometimes not. so go with the proper chat SDKs.Persist

© 2022 - 2024 — McMap. All rights reserved.