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

3,392

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.

Share:
3,392
Ultronn
Author by

Ultronn

Updated on December 10, 2022

Comments

  • Ultronn
    Ultronn over 1 year

    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?