How to send notifications to specific device on Flutter/Firebase Cloud Messaging without using Firebase Cloud Messaging Console

858

What's wrong with using cloud functions? Makes your life easier, and you have more abilities as a site admin.

There is a way to send messages over HTTP requests in your fluter app. But this means that you will be storing your messaging key in your code and shipping it, this is not advise, neither best practice. Regardless of the method you decide to proceed with, you will also have to capturing the devices' FCM tokens somewhere in your FireStore database, because that is the address you want to push your notifications to.

Using cloud functions is advised, it has great documentation, and it's almost for free up to 2 million cloud function invocations per month, then it's around $0.4 for every 1 million function, do you realize what that means if you have 2 million notifications per month?

Share:
858
muhendisberat
Author by

muhendisberat

Updated on December 31, 2022

Comments

  • muhendisberat
    muhendisberat over 1 year

    I can send notifications to all devices via Firebase Cloud Messaging Console. I can receive them in my Flutter app. That's not a problem.

    But I want to send notifications to specific devices. Not to all of them. And I want to send notifications in Flutter. I don't want to use Cloud Messaging Console for that because I have an Blog Application. In this application, when user follows X Person, X person needs to get a notification that "XYZ followed you!". Just like Instagram. How can i achieve that in Flutter/Firebase?

    I don't have any server side application. I only have Flutter application and as Backend I use Firebase Firestore.