android - Firebase通知推送通知getSubText

时间:2016-09-22 20:55:50

标签: android firebase notifications firebase-cloud-messaging

我使用此类来管理我的Android应用程序的通知

.timetable .active + .active .dot:before

在NotificationComapt.Builder中,有一个名为:setSubText()的方法,我想使用它。 那么,我如何获得“remoteMessage.getNotification()。getSubText()”?

1 个答案:

答案 0 :(得分:0)

NotificationCompat.Builder.setSubText()将在每个Android NotificationCompat reference documentation的通知模板中提供一些额外的文字。如果设备无法支持大幅面通知,则无效。

remoteMessage.getNotification()将通过Firebase云消息传递实施从Firebase通知控制台或您的应用服务器获取您已发送的消息的notification payload

如果您想在通知消息中添加其他数据参数,可以使用以下选项执行此操作:

  1. 在Firebase通知控制台中,在“高级选项”部分中添加自定义数据键值对。
  2. 如果您使用的是Firebase云消息传递(FCM),则可以发送messages with both notification and data payload
  3. 使用remoteMessage.getData()在客户端应用中获取邮件的数据有效负载,并使用get()方法检索特定值,然后将其用作通知中的子文本。

    希望这有帮助!

相关问题