在没有用户点击通知的情况下处理数据负载?

Mri*_*mar 5 android android-notifications firebase-cloud-messaging firebase-notifications

在后台,应用程序在通知托盘中接收通知负载,并且仅在用户点击通知时处理数据负载。

有没有办法在用户不点击通知的情况下处理数据有效负载?

AL.*_*AL. 1

根据有关处理消息的FCM 文档:

App state   Notification        Data                Both
Foreground  onMessageReceived   onMessageReceived   onMessageReceived
Background  System tray         onMessageReceived   Notification: system tray
                                                    Data: in extras of the intent.
Run Code Online (Sandbox Code Playgroud)

它不是仅通过点击通知来专门处理的。您可以在 中处理它onMessageReceived()。可以肯定的是,点击操作还取决于您如何实现它。

如果您打算让它做其他事情,请提供更多详细信息。