android - Firebase 云消息传递的动态通知图标

标签 android firebase firebase-cloud-messaging

我正在使用 Google Firebase 云消息传递 (FCM)。 FCM 将通知图标作为应用程序图标发送。我想从 URL 发送动态图标,但它不起作用。是否可以发送动态通知图标?

{
  "notification":{
    "title":"App Title",  
    "body":"descriptions",
    "icon":"http://example.com/abc.png",
    "click_action":"FCM_PLUGIN_ACTIVITY"
  },
  "data":{
    "state":"contact",  
    "param2":"value2"
  },
    "to":"/topics/all",
    "priority":"high"
}

最佳答案

没有。您在 icon 参数中指定的图标需要是已存在于您的 APK 中的图像资源。

icon Sets the notification icon to myicon for drawable resource myicon. If you don't send this key in the request, FCM displays the launcher icon specified in your app manifest.

https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support

关于android - Firebase 云消息传递的动态通知图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43303218/

相关文章:

firebase - 设置不同的声音通知

android - 升级到 firebase messaging 17.1.0 后未生成 token

使用 Flutter 和 FCM 终止应用程序时,Android 设备未收到通知消息

android studio 与运行的 windows 不兼容

Android ScrollView 与 ListView

java - Firebase 数据库 DataSnapshot 不工作

android - 从服务器检查设备可用性的最佳方法是什么

java - JDK 8 的要求检查失败 ('1.8.*' )!检测到版本: 13. 0.2

android - 如何为 AlertDialog 进行 Robolectric 测试

java - 如何识别随机ID并将其称为 child ?