FCM通知消息未崩溃 [英] FCM notification messages not collapsing

查看:52
本文介绍了FCM通知消息未崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到当应用程序在后台运行时,当我发送FCM有效负载时,我看到显示的通知消息与文档一致,但是我看到收到的每条通知消息的本机通知.当我的应用程序在后台运行时,我收到3条推送消息(带有通知有效负载),现在我在通知托盘中看到3条本机通知.为什么它们没有崩溃?默认情况下,根据FCM文档,所有通知消息都是可折叠的. 对文档的引用: https://firebase.google.com/docs/cloud -messaging/concept-options

I noticed that when i send FCM payload when app is in background, i see the notification message being shown which is as per docs, but i see native notifications for every notification message received. When my app was in the background, i received 3 push messages (with notification payload) and i now see 3 native notifications in the notification tray. Why are they not getting collapsed ? By default, according to FCM docs, all notification messages are collapsible. Reference to the doc: https://firebase.google.com/docs/cloud-messaging/concept-options

我正在我的app \ build.gradle中使用编译'com.google.firebase:firebase-messaging:10.0.0'

I am using compile 'com.google.firebase:firebase-messaging:10.0.0' in my app\build.gradle

推荐答案

在这种情况下,应使用"Tag"变量.通知有效负载中应设置相同的标签.完整的通知有效负载如下,它对我有用.

In this case the "Tag" variable should be used. There should be same Tag set in the notifications payload. The complete notifications payload is as follows and it is working for me.

 "notification":{
    "title":"Huawei",
    "body":"21 Notification received", 
    "sound":"default",
    "badge":4,
    "tag":"1",
    "click_action":"OPEN_ACTIVITY_1"
     "icon":"fcm_push_icon" 
  }

这篇关于FCM通知消息未崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆