FCM Firebase push notification Android/iOS
I'm using FCM
to send notifications for a project in booth plattforms, iOS
and Android
. Following are the payloads
I'm sending:
"to":"user_key",
"priority":"high",
"content_available":true,
"mutable_content":true,
"data":
"body":"test"
After reading the Firebase
documentation, the behaviour when sending notification
and data payload
through FCM
is:
iOS
- You won't see banner if
notification
->body
is not defined.
Android
- If you pass
data payload
only, it will receive data when is inbackground
. - If you pass
notification_payload
,system tray
will handle it.
The thing is:
For Android
I want to avoid to pass notification_payload
in order to receive data when app is in background (in this way onMessageReceived() will be called). But then, I won´t receive notifications
in iOS
.
Help/Suggestions appreciated.
android ios firebase push-notification firebase-cloud-messaging
add a comment |
I'm using FCM
to send notifications for a project in booth plattforms, iOS
and Android
. Following are the payloads
I'm sending:
"to":"user_key",
"priority":"high",
"content_available":true,
"mutable_content":true,
"data":
"body":"test"
After reading the Firebase
documentation, the behaviour when sending notification
and data payload
through FCM
is:
iOS
- You won't see banner if
notification
->body
is not defined.
Android
- If you pass
data payload
only, it will receive data when is inbackground
. - If you pass
notification_payload
,system tray
will handle it.
The thing is:
For Android
I want to avoid to pass notification_payload
in order to receive data when app is in background (in this way onMessageReceived() will be called). But then, I won´t receive notifications
in iOS
.
Help/Suggestions appreciated.
android ios firebase push-notification firebase-cloud-messaging
add a comment |
I'm using FCM
to send notifications for a project in booth plattforms, iOS
and Android
. Following are the payloads
I'm sending:
"to":"user_key",
"priority":"high",
"content_available":true,
"mutable_content":true,
"data":
"body":"test"
After reading the Firebase
documentation, the behaviour when sending notification
and data payload
through FCM
is:
iOS
- You won't see banner if
notification
->body
is not defined.
Android
- If you pass
data payload
only, it will receive data when is inbackground
. - If you pass
notification_payload
,system tray
will handle it.
The thing is:
For Android
I want to avoid to pass notification_payload
in order to receive data when app is in background (in this way onMessageReceived() will be called). But then, I won´t receive notifications
in iOS
.
Help/Suggestions appreciated.
android ios firebase push-notification firebase-cloud-messaging
I'm using FCM
to send notifications for a project in booth plattforms, iOS
and Android
. Following are the payloads
I'm sending:
"to":"user_key",
"priority":"high",
"content_available":true,
"mutable_content":true,
"data":
"body":"test"
After reading the Firebase
documentation, the behaviour when sending notification
and data payload
through FCM
is:
iOS
- You won't see banner if
notification
->body
is not defined.
Android
- If you pass
data payload
only, it will receive data when is inbackground
. - If you pass
notification_payload
,system tray
will handle it.
The thing is:
For Android
I want to avoid to pass notification_payload
in order to receive data when app is in background (in this way onMessageReceived() will be called). But then, I won´t receive notifications
in iOS
.
Help/Suggestions appreciated.
android ios firebase push-notification firebase-cloud-messaging
android ios firebase push-notification firebase-cloud-messaging
edited Nov 12 '18 at 11:58
IrApp
asked Nov 12 '18 at 9:48
IrAppIrApp
6381030
6381030
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Server should use different json structures for IOS and Android push request. For example:
Android:
[data] => Array
(
[title] => Test
[message] => Message
)
IOS:
[notification] => Array
(
[title] => Title
[body] => Body
[sound] => 1
[vibrate] => 1
)
[data] => Array
(
[custom_key] => custom_value
)
You can edit it according to your task.
I'm using Firebase Cloud Messaging, can't handle that.
– IrApp
Nov 12 '18 at 11:51
Sorry, could you clarify. Are you just testing in the firebase console for sending notifications?
– Onix
Nov 12 '18 at 11:52
I have a project in both platforms, Android and iOS. I'm implementing Firebase push notifications for booth projects. Question edited.
– IrApp
Nov 12 '18 at 11:57
Understood, but someone should execute the sending of push notification into mobile platforms. For example, API? Where does the sending process begin?
– Onix
Nov 12 '18 at 12:00
DOCU: firebase.google.com/docs/cloud-messaging/… , API: fcm.googleapis.com/fcm/send
– IrApp
Nov 12 '18 at 12:02
|
show 4 more comments
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%2f53259518%2ffcm-firebase-push-notification-android-ios%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Server should use different json structures for IOS and Android push request. For example:
Android:
[data] => Array
(
[title] => Test
[message] => Message
)
IOS:
[notification] => Array
(
[title] => Title
[body] => Body
[sound] => 1
[vibrate] => 1
)
[data] => Array
(
[custom_key] => custom_value
)
You can edit it according to your task.
I'm using Firebase Cloud Messaging, can't handle that.
– IrApp
Nov 12 '18 at 11:51
Sorry, could you clarify. Are you just testing in the firebase console for sending notifications?
– Onix
Nov 12 '18 at 11:52
I have a project in both platforms, Android and iOS. I'm implementing Firebase push notifications for booth projects. Question edited.
– IrApp
Nov 12 '18 at 11:57
Understood, but someone should execute the sending of push notification into mobile platforms. For example, API? Where does the sending process begin?
– Onix
Nov 12 '18 at 12:00
DOCU: firebase.google.com/docs/cloud-messaging/… , API: fcm.googleapis.com/fcm/send
– IrApp
Nov 12 '18 at 12:02
|
show 4 more comments
Server should use different json structures for IOS and Android push request. For example:
Android:
[data] => Array
(
[title] => Test
[message] => Message
)
IOS:
[notification] => Array
(
[title] => Title
[body] => Body
[sound] => 1
[vibrate] => 1
)
[data] => Array
(
[custom_key] => custom_value
)
You can edit it according to your task.
I'm using Firebase Cloud Messaging, can't handle that.
– IrApp
Nov 12 '18 at 11:51
Sorry, could you clarify. Are you just testing in the firebase console for sending notifications?
– Onix
Nov 12 '18 at 11:52
I have a project in both platforms, Android and iOS. I'm implementing Firebase push notifications for booth projects. Question edited.
– IrApp
Nov 12 '18 at 11:57
Understood, but someone should execute the sending of push notification into mobile platforms. For example, API? Where does the sending process begin?
– Onix
Nov 12 '18 at 12:00
DOCU: firebase.google.com/docs/cloud-messaging/… , API: fcm.googleapis.com/fcm/send
– IrApp
Nov 12 '18 at 12:02
|
show 4 more comments
Server should use different json structures for IOS and Android push request. For example:
Android:
[data] => Array
(
[title] => Test
[message] => Message
)
IOS:
[notification] => Array
(
[title] => Title
[body] => Body
[sound] => 1
[vibrate] => 1
)
[data] => Array
(
[custom_key] => custom_value
)
You can edit it according to your task.
Server should use different json structures for IOS and Android push request. For example:
Android:
[data] => Array
(
[title] => Test
[message] => Message
)
IOS:
[notification] => Array
(
[title] => Title
[body] => Body
[sound] => 1
[vibrate] => 1
)
[data] => Array
(
[custom_key] => custom_value
)
You can edit it according to your task.
answered Nov 12 '18 at 11:44
OnixOnix
4378
4378
I'm using Firebase Cloud Messaging, can't handle that.
– IrApp
Nov 12 '18 at 11:51
Sorry, could you clarify. Are you just testing in the firebase console for sending notifications?
– Onix
Nov 12 '18 at 11:52
I have a project in both platforms, Android and iOS. I'm implementing Firebase push notifications for booth projects. Question edited.
– IrApp
Nov 12 '18 at 11:57
Understood, but someone should execute the sending of push notification into mobile platforms. For example, API? Where does the sending process begin?
– Onix
Nov 12 '18 at 12:00
DOCU: firebase.google.com/docs/cloud-messaging/… , API: fcm.googleapis.com/fcm/send
– IrApp
Nov 12 '18 at 12:02
|
show 4 more comments
I'm using Firebase Cloud Messaging, can't handle that.
– IrApp
Nov 12 '18 at 11:51
Sorry, could you clarify. Are you just testing in the firebase console for sending notifications?
– Onix
Nov 12 '18 at 11:52
I have a project in both platforms, Android and iOS. I'm implementing Firebase push notifications for booth projects. Question edited.
– IrApp
Nov 12 '18 at 11:57
Understood, but someone should execute the sending of push notification into mobile platforms. For example, API? Where does the sending process begin?
– Onix
Nov 12 '18 at 12:00
DOCU: firebase.google.com/docs/cloud-messaging/… , API: fcm.googleapis.com/fcm/send
– IrApp
Nov 12 '18 at 12:02
I'm using Firebase Cloud Messaging, can't handle that.
– IrApp
Nov 12 '18 at 11:51
I'm using Firebase Cloud Messaging, can't handle that.
– IrApp
Nov 12 '18 at 11:51
Sorry, could you clarify. Are you just testing in the firebase console for sending notifications?
– Onix
Nov 12 '18 at 11:52
Sorry, could you clarify. Are you just testing in the firebase console for sending notifications?
– Onix
Nov 12 '18 at 11:52
I have a project in both platforms, Android and iOS. I'm implementing Firebase push notifications for booth projects. Question edited.
– IrApp
Nov 12 '18 at 11:57
I have a project in both platforms, Android and iOS. I'm implementing Firebase push notifications for booth projects. Question edited.
– IrApp
Nov 12 '18 at 11:57
Understood, but someone should execute the sending of push notification into mobile platforms. For example, API? Where does the sending process begin?
– Onix
Nov 12 '18 at 12:00
Understood, but someone should execute the sending of push notification into mobile platforms. For example, API? Where does the sending process begin?
– Onix
Nov 12 '18 at 12:00
DOCU: firebase.google.com/docs/cloud-messaging/… , API: fcm.googleapis.com/fcm/send
– IrApp
Nov 12 '18 at 12:02
DOCU: firebase.google.com/docs/cloud-messaging/… , API: fcm.googleapis.com/fcm/send
– IrApp
Nov 12 '18 at 12:02
|
show 4 more comments
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%2f53259518%2ffcm-firebase-push-notification-android-ios%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