简体   繁体   English

当应用程序处于后台时,通知中未显示操作按钮

[英]Action button is not showing in the notification when the application is in background

While sending the notification and when my application is in the foreground, i am getting the notification with the action buttons in the notification, while when my application is killed or in background the notification is coming but without the action button, i am getting just the title and content body.在发送通知时,当我的应用程序在前台时,我收到通知中带有操作按钮的通知,而当我的应用程序被杀死或在后台时,通知即将到来但没有操作按钮,我得到的只是标题和内容主体。 I have tried many solution but it does work.我尝试了很多解决方案,但它确实有效。 Is android have new permission issues are introduced? android是否有新的权限问题被引入? Any help and suggestion will be appreciated.任何帮助和建议将不胜感激。 Here is the Image这是图像

As there's no any code provided I can't say what's the specific issue here, butt keep in mind.由于没有提供任何代码,我不能在这里说出具体问题是什么,但请记住。 In FCM there are 2 types of notifications:在 FCM 中有两种类型的通知:

  • Notification payload通知负载
  • Data payload数据有效载荷

When you send a notification from FCM, it is a notification payload.当您从 FCM 发送通知时,它是通知负载。 In this case if your app is killed, the notification will go directly to the system tray and will be handled by the OS.在这种情况下,如果您的应用程序被终止,通知将直接进入系统托盘并由操作系统处理。 The onMessageReceived() won't execute. onMessageReceived()不会执行。

If you send the notification from the backend side, it's a data payload.如果您从后端发送通知,则它是数据负载。 In that case the onMessageReceived() will be executed.在这种情况下,将执行onMessageReceived()

Check more here FCM Message Types在此处查看更多FCM 消息类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM