是否可以自定义在应用程序后台运行时收到的FCM推送通知?

时间:2017-03-13 02:15:36

标签: android firebase push-notification firebase-cloud-messaging

如果应用程序在前台,我可以自定义通知,虽然我在应用程序背景时阅读。 FCM默认处理通知(这是否意味着我们无法自定义这些通知?)

1 个答案:

答案 0 :(得分:0)

默认情况下,您会收到:

"notification":{
     "title": "Awesome notif!",
     "body": "Test notif"
 }

只有当你处于前台时才能处理这个。

如果您发送:

"data":{
     "title": "Awesome notif!",
     "body": "Test notif"
 },

它将由背景和前景处理。

我强烈建议您阅读this article,它解释了您必须了解的所有内容。