图像不显示在通知 React Native Firebase 中

发布于 2025-01-10 04:52:31 字数 837 浏览 4 评论 0原文

我在 rnfirebase v5.6.0 的通知中遇到图像问题。 我从消息中收到图像,并且图像链接正确,但无法在通知中显示图像。 它不会一直发生,它会在某些未知的情况下发生。 这是我的显示通知代码


const notification = new firebase.notifications.Notification({
 sound: 'default',
 show_in_foreground: true,
})
 .setNotificationId(notificationId)
 .setTitle(notificationData.title)
 .setBody(notificationData.body)
 .setData(notificationData.data)
 .android.setColor('#ffffff')
 .android.setAutoCancel(true)
 .android.setChannelId('channelId')
 .android.setSmallIcon('ic_stat_name')
 .android.setPriority(firebase.notifications.Android.Priority.Max)
 .android.setBigPicture(message._android._bigPicture.picture)
 .android.setLargeIcon(message._android._largeIcon);

firebase.notifications().displayNotification(notification);

有关更多信息,我的 React Native 版本是 0.61.5,我的 React-Native-Firebase 版本是 5.6.0。

I have a problem with images in notification with rnfirebase v5.6.0.
I receive image from messaging and the image link correct but can't show the image in notification.
It does not happen at all the time, it happens in some unknown situations.
This is my display notification code


const notification = new firebase.notifications.Notification({
 sound: 'default',
 show_in_foreground: true,
})
 .setNotificationId(notificationId)
 .setTitle(notificationData.title)
 .setBody(notificationData.body)
 .setData(notificationData.data)
 .android.setColor('#ffffff')
 .android.setAutoCancel(true)
 .android.setChannelId('channelId')
 .android.setSmallIcon('ic_stat_name')
 .android.setPriority(firebase.notifications.Android.Priority.Max)
 .android.setBigPicture(message._android._bigPicture.picture)
 .android.setLargeIcon(message._android._largeIcon);

firebase.notifications().displayNotification(notification);

For more information my react native version is 0.61.5 and my react-native-firebase version is 5.6.0.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2025-01-17 04:52:31

将react-native-firebase包更新到6.0.0及以上版本,并使用notifee包进行通知

Update the react-native-firebase package to version 6.0.0 and above and use notifee package for notifications

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文