I’m trying to display an image with the notification body, how can I achieve this.
I have a nodejs backend that sends the notifications to all listed users with a specific push token.
the backend looks like this:
static async createMessages(message, pushTokens) {
const { body, title, product, productImg } = message;
let messages = ;
for (let pushToken of pushTokens) {
if (!Expo.isExpoPushToken(pushToken)) {
console.error(Push token ${pushToken} is not a valid Expo push token
);
continue;
}
messages.push({
to: pushToken,
sound: ‘default’,
title: title,
subtitle: product,
body: body,
launchImageName: productImg,
data: {},
})
}
return messages;
}
static sendMessages = async (messages) => {
let chunks = PushNotificationsUtil.expo.chunkPushNotifications(messages);
let tickets = [];
for (let chunk of chunks) {
try {
console.log(PushNotificationsUtil.expo)
let ticketChunk = await PushNotificationsUtil.expo.sendPushNotificationsAsync(chunk);
tickets.push(...ticketChunk);
} catch (error) {
console.error(error);
}
}
return tickets;
}
all data is displayed. apart from the image … on the launchImageName property, I’m sending an image URL.
any help will be highly appreciated.