push-notification - 当应用程序被杀死时,推送通知不显示消息正文。它只显示应用程序的默认图标
问题描述
当我的应用程序运行时,会收到通知以及标题消息和应用程序图标,如下所示
但是当我被杀死时,它不会显示消息正文,仅显示图标和标题,即像这样的应用程序名称
而我的 OnMessagerecieved 方法的代码是这样的
@Override
public void onMessageReceived(RemoteMessage message) {
String from = message.getFrom();
Map data = message.getData();
datarecieved = message;
String orderIds= "";
try {
if(data.get("accountId")!=null)
orderIds = data.get("accountId").toString();
} catch (Exception e) {
e.printStackTrace();
}
String userId=SharedPrefsUtils.getStringPreference(getApplicationContext(),"user_id");
if(userId!=null&&userId.length()>0) {
if (orderIds.equals("-101")) {
generateNotificationForOrder(getApplicationContext(), data);
} else if (!orderIds.equals("")) {
generateNotification(getApplicationContext(), data);
}
}
}
而我的通知 JSON 是这样的
{“to”:“fcm_token”,“data”:{“type”:“101 / 102 / 103”,“msg”:“CustomerId”,“id”:“0”,“accountId”:“-101” }, "content_available": 真 }
解决方案
推荐阅读
- javascript - 当我们单击 React JS 中的添加行按钮时,如何自动滚动到表格中新添加的行
- php - Codeigniter 3 - 当我点击一个链接时,它使用完整路径
- ionic4 - ionic 4 ion-button中的下载属性是什么意思?
- python - 有条件地替换numpy数组中的列
- google-app-engine - 所有 App Engine 实例于 25.12 重新启动。和 31.12
- python - 使用带有附加参数的 python 运行程序
- node.js - 是否可以在运行 Ubuntu 机器(服务器)上为 vuejs 项目设置开发模式环境
- android - 如何在android中使用默认拨号屏幕?
- c - 如何在C中将可变参数转换为数组
- graphql - 这个 graphql 模式有什么问题?索引键的类型不匹配