android进程杀死了如何推送,当Android应用程序处于被杀死状态时,如何从推送通知(使用FCM)获取“数据有效负载”?(How can I get “data payload” from pu...
当Android应用程序处于被杀死状态时,如何从推送通知(使用FCM)获取“数据有效负载”?(How can I get “data payload” from push notification (using FCM) when android app is in killed state?)我的推送通知(使用FCM)在前台和后台状态下正常工作,但在杀死状态下,我只能从系统托盘接收通知但无法获得
当Android应用程序处于被杀死状态时,如何从推送通知(使用FCM)获取“数据有效负载”?(How can I get “data payload” from push notification (using FCM) when android app is in killed state?)
我的推送通知(使用FCM)在前台和后台状态下正常工作,但在杀死状态下,我只能从系统托盘接收通知但无法获得“数据有效负载”。 我知道onMessageReceived()没有在kill状态下调用(如果我错了就纠正我),有没有办法在kill状态下调用此方法或以任何其他方式获取“数据有效负载”。 请帮忙!
My push notification(using FCM) is working correctly in foreground and background state, but in killed state I am able to receive only notification from the system tray but can't get "data payload". I am aware about the fact that onMessageReceived() is not called in killed state(correct me if I am wrong), is there any way to call this method in killed state as well or any other way to get "data payload". Please help!
原文:https://stackoverflow.com/questions/44844628
更新时间:2020-02-06 17:09
最满意答案
如果您希望在应用程序处于终止状态时读取数据有效负载,则不发送通知有效负载仅使用数据有效负载管理所有操作。 如果应用程序处于终止状态并且您发送通知有效负载,那么它不会调用onRecive()方法,因此在数据有效负载中发送通知和通知消息并在onRecive()中生成通知
if you want read data payload when when app in kill state then don`t send notification payload manage all operation using data payload only . if app in kill state and you send notification payload then it does not call onRecive() method so send tital and message of notification in data payload and generate notification in onRecive()
2017-06-30
相关问答
FCM有效载荷中content-available的mutable-content和content-available不正确。 它应该被格式化为mutable_content和content_available 。 两者都是布尔值,并且也必须在notification参数之外。 像这样: {
"to": "dWB537Nz1GA:APA91bHIjJ5....",
"content_available": true,
"mutable_content": true,
"da
...
我觉得上面的所有答案都很有帮助,但是如果你需要从服务器端用java开发它,你需要这样做: JSONArray registration_ids = new JSONArray(Arrays.asList(data));
message.put("registration_ids", registration_ids);
message.put("priority", "high");
JSONObject notification = new JSONObject();
n
...
如果您使用的是Firebase控制台,请选择否。 如果您从Firebase控制台发送消息,而您的应用程序位于后台,则只有通知才能使用任何自定义数据。 如果用户从不点击伴随数据丢失的通知。 如果要将数据发送到对其操作至关重要的应用程序,则应发送数据消息,您可以通过FCM REST API执行此操作。 详细了解文档中不同类型的消息。 If you are using the Firebase console then no. If you send a message from the Firebas
...
这是一个众所周知的问题。 您应该通过服务器以数据消息的形式发送通知,而不是通过控制台发送通知。 如果那是不可能的,出于某种原因,你应该查看本教程。 It's a known issue. You should be sending your notifications via your server, as a Data Message, and not through the Console. If that's not possible, for some reason, you should
...
如果您希望在应用程序处于终止状态时读取数据有效负载,则不发送通知有效负载仅使用数据有效负载管理所有操作。 如果应用程序处于终止状态并且您发送通知有效负载,那么它不会调用onRecive()方法,因此在数据有效负载中发送通知和通知消息并在onRecive()中生成通知 if you want read data payload when when app in kill state then don`t send notification payload manage all operation u
...
如果始终从服务器接收有效负载作为“数据”,则始终会调用onMessageReceived()。 示例:来自服务器的有效负载应如下所示: {
"data":{
"id": 1,
"missedRequests": 5
"addAnyDataHere": 123
},
"to":"fhiT7evmZk8:APA91bFJq7Tkly4BtLRXdYvqHno2vHCRkzpJT8QZy0TlIGs......"
}
有关此问题的更多信息。 请参阅以下网址: 在后台使用app时未调用Fir
...
查看文档: https : //firebase.google.com/docs/cloud-messaging/http-server-ref android_channel_id通知的频道ID(Android O中的新增功能)。 在收到使用此密钥的任何通知之前,应用必须创建具有此ID的频道。 如果您未在请求中发送此密钥,或者您的应用尚未创建提供的频道ID,则FCM会使用您的应用清单中指定的频道ID。 尝试在你即将发布到fcm的json中包含android_channel_id 。 我不知道为什
...
尝试这个: var data = new
{
to = deviceId,
notification = new
{
body = not_title,
title = "ABC",
sound = "En
...
当应用程序被杀死时单击push时,将不会调用didReceiveRemoteNotification 。 推送详细信息将在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
...
如果应用程序处于后台状态,则UINotification称为应用程序 didReceiveRemoteNotification,如果应用程序处于打开状态UINotification,则称为application:didFinishLaunchingWithOptions ,并且无法在未单击iOS中的通知的情况下获取数据。 If the app is in background state UINotification called application didReceiveRemoteNotif
...
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐
所有评论(0)