如何使用rnfirebase在react-native android中发送带有图像的推送通知 [英] How to send push notification with image in react-native android using rnfirebase
问题描述
我正在使用rnfirebase在android中成功发送仅通知和通知数据推送通知. 我如何在我关注的情况下仅发送带有图片的推送通知数据 https://rnfirebase.io/docs/v5.xx/notifications/receiving-通知
I am sending notification only and notification-data push notifications successfully in android using rnfirebase. How can i send data only push notification with image as I am following https://rnfirebase.io/docs/v5.x.x/notifications/receiving-notifications
推荐答案
如果使用firebase.notifications().displayNotification
显示通知,则可以使用notification.android上的/reference/AndroidNotification#setBigPicture"rel =" noreferrer> setBigPicture .
If you are displaying your notifications with firebase.notifications().displayNotification
, you can use Notification.BigPictureStyle in order to display an image in your notification by calling setBigPicture on notification.android
.
示例:
const notification = new firebase.notifications.Notification()
.setTitle(title)
notification.android.setBigPicture('url of your image')
firebase.notifications().displayNotification(notification)
这篇关于如何使用rnfirebase在react-native android中发送带有图像的推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!