这是我的有效载荷。当我发送邮件时,我可以接收通知,但是 click_action 被忽略,它启动了启动器活动。但是,当我将“ click_action” 放在通知块中时,它正在工作。为什么 android阻止会被忽略?
{
"to": "my tocken",
"data": {
"url": "dfhdfh",
"action": "fhdfg",
},
"notification": {
"title": "dfgsdfg",
"body": "dfgdg"
},
"android": {
"notification": {
"click_action": "NOTIFICATION_ACTIVITY"
}
}
}
答案 0 :(得分:0)
firebase推送通知中有三种消息
并且在android端,这些类型的访问级别彼此有点不同,因此您需要了解在后端和android端都实现推送通知之前
,您可以更好地理解答案 1 :(得分:0)
我认为您应该只发送数据消息,然后在onMessageReceived
的{{1}}中,您可以生成自定义通知并从FirebaseMessagingService
对象中检索数据。
RemoteMessage
在数据对象下,您可以具有多个用于通知的键值对以及您要执行的所有其他操作。
也将public class CloudMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage){
//Extract data from remote message
//trigger notification
}
}
声明为CloudMessagingService
中的服务AndroidManifest.xml
intent-filter