How to send push notification with image in react-native android using rnfirebase

一世执手 提交于 2020-01-02 07:54:25

问题


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


回答1:


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.

Example:

const notification = new firebase.notifications.Notification()
    .setTitle(title)

notification.android.setBigPicture('url of your image')

firebase.notifications().displayNotification(notification)


来源:https://stackoverflow.com/questions/52533068/how-to-send-push-notification-with-image-in-react-native-android-using-rnfirebas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!