FCM from multiple senders but within the same app
How can i send multiple notifications using FCM but within the same server side, and be able to distinguish between notification x and y on the client side and send them to different Notification Channel
?
maybe with
RemoteMessage.getFrom?
EDIT
I tried setting notification_id and it does not work.
EDIT:
I can add a Data payload and restrict the notification in one of my classes and add a switch statement which will divide according to my Notification but i need to handle the data in the background and not foreground.
android firebase firebase-cloud-messaging
add a comment |
How can i send multiple notifications using FCM but within the same server side, and be able to distinguish between notification x and y on the client side and send them to different Notification Channel
?
maybe with
RemoteMessage.getFrom?
EDIT
I tried setting notification_id and it does not work.
EDIT:
I can add a Data payload and restrict the notification in one of my classes and add a switch statement which will divide according to my Notification but i need to handle the data in the background and not foreground.
android firebase firebase-cloud-messaging
Do you want N senders to 1 device?
– Gonzalo
Nov 13 '18 at 11:45
within the same app, yes. so if (x happens) send notification x else if(y happens) send notification y and client app can receive x and y how can i distinguish between x and y?
– KARAM JABER
Nov 13 '18 at 11:54
I did something similar but in the other direction, 1 sender for N devices. What I did was to create a firebase function that reads from a collection, insert in that collection different messages. The function would read the message data, like sender, receiver, event, message, everything you want. In my case it reads message from 1 sender and fire FCM for all the devices subscribed to him, some code: github.com/Fic-Spinoff/family-care-firebase
– Gonzalo
Nov 13 '18 at 12:00
add a comment |
How can i send multiple notifications using FCM but within the same server side, and be able to distinguish between notification x and y on the client side and send them to different Notification Channel
?
maybe with
RemoteMessage.getFrom?
EDIT
I tried setting notification_id and it does not work.
EDIT:
I can add a Data payload and restrict the notification in one of my classes and add a switch statement which will divide according to my Notification but i need to handle the data in the background and not foreground.
android firebase firebase-cloud-messaging
How can i send multiple notifications using FCM but within the same server side, and be able to distinguish between notification x and y on the client side and send them to different Notification Channel
?
maybe with
RemoteMessage.getFrom?
EDIT
I tried setting notification_id and it does not work.
EDIT:
I can add a Data payload and restrict the notification in one of my classes and add a switch statement which will divide according to my Notification but i need to handle the data in the background and not foreground.
android firebase firebase-cloud-messaging
android firebase firebase-cloud-messaging
edited Nov 13 '18 at 13:14
KARAM JABER
asked Nov 13 '18 at 11:18
KARAM JABERKARAM JABER
528
528
Do you want N senders to 1 device?
– Gonzalo
Nov 13 '18 at 11:45
within the same app, yes. so if (x happens) send notification x else if(y happens) send notification y and client app can receive x and y how can i distinguish between x and y?
– KARAM JABER
Nov 13 '18 at 11:54
I did something similar but in the other direction, 1 sender for N devices. What I did was to create a firebase function that reads from a collection, insert in that collection different messages. The function would read the message data, like sender, receiver, event, message, everything you want. In my case it reads message from 1 sender and fire FCM for all the devices subscribed to him, some code: github.com/Fic-Spinoff/family-care-firebase
– Gonzalo
Nov 13 '18 at 12:00
add a comment |
Do you want N senders to 1 device?
– Gonzalo
Nov 13 '18 at 11:45
within the same app, yes. so if (x happens) send notification x else if(y happens) send notification y and client app can receive x and y how can i distinguish between x and y?
– KARAM JABER
Nov 13 '18 at 11:54
I did something similar but in the other direction, 1 sender for N devices. What I did was to create a firebase function that reads from a collection, insert in that collection different messages. The function would read the message data, like sender, receiver, event, message, everything you want. In my case it reads message from 1 sender and fire FCM for all the devices subscribed to him, some code: github.com/Fic-Spinoff/family-care-firebase
– Gonzalo
Nov 13 '18 at 12:00
Do you want N senders to 1 device?
– Gonzalo
Nov 13 '18 at 11:45
Do you want N senders to 1 device?
– Gonzalo
Nov 13 '18 at 11:45
within the same app, yes. so if (x happens) send notification x else if(y happens) send notification y and client app can receive x and y how can i distinguish between x and y?
– KARAM JABER
Nov 13 '18 at 11:54
within the same app, yes. so if (x happens) send notification x else if(y happens) send notification y and client app can receive x and y how can i distinguish between x and y?
– KARAM JABER
Nov 13 '18 at 11:54
I did something similar but in the other direction, 1 sender for N devices. What I did was to create a firebase function that reads from a collection, insert in that collection different messages. The function would read the message data, like sender, receiver, event, message, everything you want. In my case it reads message from 1 sender and fire FCM for all the devices subscribed to him, some code: github.com/Fic-Spinoff/family-care-firebase
– Gonzalo
Nov 13 '18 at 12:00
I did something similar but in the other direction, 1 sender for N devices. What I did was to create a firebase function that reads from a collection, insert in that collection different messages. The function would read the message data, like sender, receiver, event, message, everything you want. In my case it reads message from 1 sender and fire FCM for all the devices subscribed to him, some code: github.com/Fic-Spinoff/family-care-firebase
– Gonzalo
Nov 13 '18 at 12:00
add a comment |
2 Answers
2
active
oldest
votes
Create the notification_key, which identifies the device group by mapping a particular group (typically a user) to all of the group's associated registration tokens. You can create notification keys on the app server or on Android client apps.
please check this link
https://firebase.google.com/docs/cloud-messaging/android/device-group
I dont want to send a single notification to multiple devices... i want to send multiple notification from different senders within the same app to a single device.... thanks for trying though.
– KARAM JABER
Nov 13 '18 at 11:41
when you defining notification_key, you can assign that key for single device and send multiple notification just to that single device which has that key
– Amir
Nov 13 '18 at 11:49
yes but you are still restricting to one app, i want to define multiple senders to same app if i assign a notification key only the notifications with key will be called from the same app...
– KARAM JABER
Nov 13 '18 at 11:56
add a comment |
Answering the question in the title: FCM from multiple senders but within the same app
If sender == Firebase Project
then I don't think it is possible.
If sender == a client inside the same Firebase Project
(like an iOS app, multiple servers, another Android app), then you need to create those apps inside your Firebase Project (for iOS and Android apps) and use the server key (for the servers)
If sender == function
(like "Update Entity A", "show notification for promotion", etc), then you can use the data
field inside the notification. We usually add an action
field inside the data
field. Both the receiver
(iOS or Android app) and the sender
(usually a server, but can also be a mobile app) know the list of possible action
s. Receiver
s know what to do when they receive them (if app receives "Update Entity A", then it starts the EntityAUpdateService).
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279860%2ffcm-from-multiple-senders-but-within-the-same-app%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Create the notification_key, which identifies the device group by mapping a particular group (typically a user) to all of the group's associated registration tokens. You can create notification keys on the app server or on Android client apps.
please check this link
https://firebase.google.com/docs/cloud-messaging/android/device-group
I dont want to send a single notification to multiple devices... i want to send multiple notification from different senders within the same app to a single device.... thanks for trying though.
– KARAM JABER
Nov 13 '18 at 11:41
when you defining notification_key, you can assign that key for single device and send multiple notification just to that single device which has that key
– Amir
Nov 13 '18 at 11:49
yes but you are still restricting to one app, i want to define multiple senders to same app if i assign a notification key only the notifications with key will be called from the same app...
– KARAM JABER
Nov 13 '18 at 11:56
add a comment |
Create the notification_key, which identifies the device group by mapping a particular group (typically a user) to all of the group's associated registration tokens. You can create notification keys on the app server or on Android client apps.
please check this link
https://firebase.google.com/docs/cloud-messaging/android/device-group
I dont want to send a single notification to multiple devices... i want to send multiple notification from different senders within the same app to a single device.... thanks for trying though.
– KARAM JABER
Nov 13 '18 at 11:41
when you defining notification_key, you can assign that key for single device and send multiple notification just to that single device which has that key
– Amir
Nov 13 '18 at 11:49
yes but you are still restricting to one app, i want to define multiple senders to same app if i assign a notification key only the notifications with key will be called from the same app...
– KARAM JABER
Nov 13 '18 at 11:56
add a comment |
Create the notification_key, which identifies the device group by mapping a particular group (typically a user) to all of the group's associated registration tokens. You can create notification keys on the app server or on Android client apps.
please check this link
https://firebase.google.com/docs/cloud-messaging/android/device-group
Create the notification_key, which identifies the device group by mapping a particular group (typically a user) to all of the group's associated registration tokens. You can create notification keys on the app server or on Android client apps.
please check this link
https://firebase.google.com/docs/cloud-messaging/android/device-group
answered Nov 13 '18 at 11:37
AmirAmir
159214
159214
I dont want to send a single notification to multiple devices... i want to send multiple notification from different senders within the same app to a single device.... thanks for trying though.
– KARAM JABER
Nov 13 '18 at 11:41
when you defining notification_key, you can assign that key for single device and send multiple notification just to that single device which has that key
– Amir
Nov 13 '18 at 11:49
yes but you are still restricting to one app, i want to define multiple senders to same app if i assign a notification key only the notifications with key will be called from the same app...
– KARAM JABER
Nov 13 '18 at 11:56
add a comment |
I dont want to send a single notification to multiple devices... i want to send multiple notification from different senders within the same app to a single device.... thanks for trying though.
– KARAM JABER
Nov 13 '18 at 11:41
when you defining notification_key, you can assign that key for single device and send multiple notification just to that single device which has that key
– Amir
Nov 13 '18 at 11:49
yes but you are still restricting to one app, i want to define multiple senders to same app if i assign a notification key only the notifications with key will be called from the same app...
– KARAM JABER
Nov 13 '18 at 11:56
I dont want to send a single notification to multiple devices... i want to send multiple notification from different senders within the same app to a single device.... thanks for trying though.
– KARAM JABER
Nov 13 '18 at 11:41
I dont want to send a single notification to multiple devices... i want to send multiple notification from different senders within the same app to a single device.... thanks for trying though.
– KARAM JABER
Nov 13 '18 at 11:41
when you defining notification_key, you can assign that key for single device and send multiple notification just to that single device which has that key
– Amir
Nov 13 '18 at 11:49
when you defining notification_key, you can assign that key for single device and send multiple notification just to that single device which has that key
– Amir
Nov 13 '18 at 11:49
yes but you are still restricting to one app, i want to define multiple senders to same app if i assign a notification key only the notifications with key will be called from the same app...
– KARAM JABER
Nov 13 '18 at 11:56
yes but you are still restricting to one app, i want to define multiple senders to same app if i assign a notification key only the notifications with key will be called from the same app...
– KARAM JABER
Nov 13 '18 at 11:56
add a comment |
Answering the question in the title: FCM from multiple senders but within the same app
If sender == Firebase Project
then I don't think it is possible.
If sender == a client inside the same Firebase Project
(like an iOS app, multiple servers, another Android app), then you need to create those apps inside your Firebase Project (for iOS and Android apps) and use the server key (for the servers)
If sender == function
(like "Update Entity A", "show notification for promotion", etc), then you can use the data
field inside the notification. We usually add an action
field inside the data
field. Both the receiver
(iOS or Android app) and the sender
(usually a server, but can also be a mobile app) know the list of possible action
s. Receiver
s know what to do when they receive them (if app receives "Update Entity A", then it starts the EntityAUpdateService).
add a comment |
Answering the question in the title: FCM from multiple senders but within the same app
If sender == Firebase Project
then I don't think it is possible.
If sender == a client inside the same Firebase Project
(like an iOS app, multiple servers, another Android app), then you need to create those apps inside your Firebase Project (for iOS and Android apps) and use the server key (for the servers)
If sender == function
(like "Update Entity A", "show notification for promotion", etc), then you can use the data
field inside the notification. We usually add an action
field inside the data
field. Both the receiver
(iOS or Android app) and the sender
(usually a server, but can also be a mobile app) know the list of possible action
s. Receiver
s know what to do when they receive them (if app receives "Update Entity A", then it starts the EntityAUpdateService).
add a comment |
Answering the question in the title: FCM from multiple senders but within the same app
If sender == Firebase Project
then I don't think it is possible.
If sender == a client inside the same Firebase Project
(like an iOS app, multiple servers, another Android app), then you need to create those apps inside your Firebase Project (for iOS and Android apps) and use the server key (for the servers)
If sender == function
(like "Update Entity A", "show notification for promotion", etc), then you can use the data
field inside the notification. We usually add an action
field inside the data
field. Both the receiver
(iOS or Android app) and the sender
(usually a server, but can also be a mobile app) know the list of possible action
s. Receiver
s know what to do when they receive them (if app receives "Update Entity A", then it starts the EntityAUpdateService).
Answering the question in the title: FCM from multiple senders but within the same app
If sender == Firebase Project
then I don't think it is possible.
If sender == a client inside the same Firebase Project
(like an iOS app, multiple servers, another Android app), then you need to create those apps inside your Firebase Project (for iOS and Android apps) and use the server key (for the servers)
If sender == function
(like "Update Entity A", "show notification for promotion", etc), then you can use the data
field inside the notification. We usually add an action
field inside the data
field. Both the receiver
(iOS or Android app) and the sender
(usually a server, but can also be a mobile app) know the list of possible action
s. Receiver
s know what to do when they receive them (if app receives "Update Entity A", then it starts the EntityAUpdateService).
answered Nov 13 '18 at 13:26
David CorsaliniDavid Corsalini
4,04133151
4,04133151
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279860%2ffcm-from-multiple-senders-but-within-the-same-app%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you want N senders to 1 device?
– Gonzalo
Nov 13 '18 at 11:45
within the same app, yes. so if (x happens) send notification x else if(y happens) send notification y and client app can receive x and y how can i distinguish between x and y?
– KARAM JABER
Nov 13 '18 at 11:54
I did something similar but in the other direction, 1 sender for N devices. What I did was to create a firebase function that reads from a collection, insert in that collection different messages. The function would read the message data, like sender, receiver, event, message, everything you want. In my case it reads message from 1 sender and fire FCM for all the devices subscribed to him, some code: github.com/Fic-Spinoff/family-care-firebase
– Gonzalo
Nov 13 '18 at 12:00