当我的应用程序正在运行时,将收到通知以及标题消息和类似的应用程序图标 sample in Stackblitz
但是当我被杀死时,它不会显示消息正文,仅显示图标和标题,这是应用程序的名称,
而我的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就是这样
{ “至”:“ fcm_token”, “数据”:{ “类型”:“ 101/102/103”, “ msg”:“ CustomerId”, “ id”:“ 0”, “ accountId”:“-101” }, “ content_available”:是 }