Can I send fcm notifications to Firebase UserIds instead of device tokens? - flutter

I see examples where you have to extract device tokens and store them in a db to be able to send notifications to that device.
I wondered if I could use Firebase user ids to send a select list of users notifications skipping the need for tokens?

No firebase is not support to send notification using userID.
You have to integrate FCM package for getting token if firebase using below link :
https://pub.dev/packages/firebase_messaging
After getting token then only you can use this token and send the notification.
Other way of sending notification is the topic.
For topic i am giving you below link :
https://www.filledstacks.com/post/push-notifications-in-flutter-using-firebase/

No, you can't. You need to implement a custom notification sender from the firebase cloud function to send by user IDs. But you can't ignore the FCM tokens. You must register a valid FCM token of the user's device to trigger per device notification. Check the following guideline:
FCM Push Notifications for Flutter

Related

I already get fcm key of ever users,How to send notification to another user with firebase cloud messaging?In dart

I have Fcm key
and working when i put fcm trial of cloud messageing in firebase
I tried but only got same device notification,
I am expecting that when I send a message to another user The other user need to get a notification while the app is not opened

How to setup push notification with supabase in flutter?

I had just replaced my app with supabase from firebase in flutter app.
Firebase has firebase_messaging that provide push notification to device token.
Is there any facilities to create function in supabase and send notification to selected user with device token while changing in database.
If yes than please suggest some function else suggest some method to send notification.
Supabase does not provide a mechanism to send push notifications at this point, so you can use FCM or other push notification sending services to send them out to the users.
If you are going with FCM, you can setup your own backend using Firebase cloud functions or other backend service that you prefer to send the notifications from.
Typically, you would want to send push notifications to your users when there is some kind of change in the database, like when there was a new message sent or someone liked a post. You can listen to these events using Supabase database webhooks. With database webhooks, you can send your backend a request whenever you receive certain data change happening in your database.

Flutter Firebase apiKey, appId, messagingSenderId and projectId

I need to use firebase_messaging to send message from my backend to my flutter apk.
When initialize firebase, these are the 4 keys essential in the FirebaseOptions
apiKey : Is this the Server Key found in FCM?
appId : Where can I find this key?
messagingSenderId : Sender ID FCM
projectId : Where can I find this?
Besides, in order for me to send message to a single user. I need to tell Firebase who am I right? May I know which ID shall I use?
Thx
When you register with firebase you obtain the push notification token. This token is used to send a notification to the device the app is installed on.
Assuming you already initialized firebase app in flutter, and you added the google-services.json in your app. You can obtain your push notification token in the following way:
messaging = FirebaseMessaging.instance;
messaging.getToken().then((value){
print(value); //this is the push notification token
});
You can also test that you are able to receive the notification on the app from the firebase console. You can send a notification to the app under Compose notification section in the firebase console. It only requires the notification token you obtained from the app.

Ionic Capacitor One-To-One Chat Notification

Here's the thing:
I've made an one-to-one private chat with ionic capacitor, saving messages in Cloud Firestore. By far it's working fine. Both users can send and recieve messages.
On the other hand, I've made push notification with FCM(Firebase Cloud Messaging) according to official document of capacitor(https://capacitorjs.com/docs/guides/push-notifications-firebase) and from console of Firebase I can publish notificationes to certain device as I've got their tokens.
So, can I implement message notification using FCM as well when a user recieve a new message? Just like whatsapp, wechat o others common chat apps.
Attention: I'm using Ionic Capacitor + Angular. NOT cordova.
I think what you have to do is whenever you get the token , save it in your database with the user_id or device_id, then when sending message to a recipient, you get the token of the recipient from database(eg: get token where user_id=recipient_id) then send notification to that token.

Do i need to know users device ID or Device Token to send notifications to them?

How to send Notification to all those users who have downloaded my applications from apple store ??
Do i need to know users device ID or Device Token to send notifications to them ?
Assuming that you're referring to push notifications, you'll need to have the users' device tokens in order to send a notification to their devices.
Use Push Notifications.
Alternatively (another meaning):
Write them a note in an update. Or write it in the app description in the app store.