当应用在后台运行时收到Firebase消息时查找

编程入门 行业动态 更新时间:2024-10-23 13:38:32
本文介绍了当应用在后台运行时收到Firebase消息时查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我知道这个标题也有相同的问题,但不幸的是,答案不正确,被接受了!!! 此处

I know that there is the same question with this title but unfortunately it is not answered right and it is accepted!!! here

我想知道如何在应用程序处于后台时找出收到的FCM消息,以便在用户单击之前对收到的消息进行一些操作.但是当应用程序在后台onMessageReceived时不会触发!

I want to know how I can find out a FCM message received when app is in background to do some action on message received before clicking by user. but when app is in background onMessageReceived is not triggered!

我在Google上搜索了很多东西,却找不到一个好方法.

I googled so much and could not find a good way.

推荐答案

正如我在评论部分中提到的,当发送带有notification消息有效负载的消息时,Android系统(通知托盘)将处理推送通知当您的应用程序在后台运行时.

As I've mentioned in the comments section, when sending a message with a notification message payload the Android System (Notification Tray) will handle the push notification when your app is in background.

您应该使用仅data的消息有效负载,以便始终由onMessageReceived()处理.

You should use a data-only message payload, so that it will always be handled by onMessageReceived().

有关详细信息,请参见在Android中处理消息文档

See the Handling Messages docs in Android for more details.

更多推荐

当应用在后台运行时收到Firebase消息时查找

本文发布于:2023-11-27 08:33:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637299.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用在   后台   消息   Firebase

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!