[英]How do I get a call back for notification received in android?
Is it possible/is there a reliable way to get a call back when a notification is received on the android platform? 在Android平台上收到通知时,是否可以/是否有可靠的方法来回电? ie I want to record when the notification is received (not when it is later opened). 即我想记录何时收到通知(而不是以后打开时)。
No, It's your app which receives the message so if you need things logged, then log it. 不,这是您的应用程序收到的消息,因此,如果您需要记录所有内容,请对其进行记录。 Simply handle it as you like once you receive it. 收到后即可根据需要随意处理。 Note that if you use FCM with Notification message
message type, then you will not be directly notified about message arrival when app is in background (notification will be automatically posted by Firebase - your app will get message payload once use taps the notification). 请注意,如果您将FCM与Notification message
消息类型一起使用,则当应用程序在后台运行时,不会直接收到有关消息到达的通知(Firebase会自动发布通知-使用该通知时,您的应用程序将获得消息有效负载)。 In such case consider switching to Data messages
so you will get it no matter your app is in foreground or not. 在这种情况下,请考虑切换到“ Data messages
这样无论您的应用程序是否处于前台,您都将获得它。
See docs: https://firebase.google.com/docs/cloud-messaging/downstream 查看文件: https : //firebase.google.com/docs/cloud-messaging/downstream
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.