I am developing an app with react-native and AWS and testing push notification using AWS Pinpoint. There is no problem in sending and receiving push notifications, but I can not display an icon in the push notification.
Belows are my code.
const sendPushNotifications = (token, status, navi, userData) => {
const messageRequest = CreateMessageRequest(token, status, navi, userData);
AWS.config.update({
region: region,
apiVersion: 'latest',
credentials: {
accessKeyId: Config.AWS_ACCESS_KEY,
secretAccessKey: Config.AWS_SECRET_KEY,
},
});
const params = {
ApplicationId: Config.PINPOINT_APP_ID,
MessageRequest: messageRequest,
};
const pinpoint = new AWS.Pinpoint();
pinpoint.sendMessages(params, function (err, data) {
if (err) console.error(err);
else {
}
});
};
const CreateMessageRequest = (token, status, navi, userData) => {
const recipientPushToken = token;
const title = 'title';
const body = 'body';
const messageRequest = {
Addresses: {
[recipientPushToken]: {
ChannelType: 'GCM',
},
},
MessageConfiguration: {
GCMMessage: {
Action: 'OPEN_APP',
RawContent: JSON.stringify({
notification: {
title: title,
body: body,
ImageUrl:
'https://domain/ic_notification.png',
ImageIconUrl:
'https://domain/ic_notification.png',
SmallImageIconUrl:
'https://domain/ic_notification.png',
},
data: {
message: body,
title: title,
navi: navi,
userData: userData,
ImageUrl:
'https://domain/ic_notification.png',
ImageIconUrl:
'https://domain/ic_notification.png',
SmallImageIconUrl:
'https://domain/ic_notification.png',
},
}),
ImageUrl:
'https://domain/ic_notification.png',
ImageIconUrl:
'https://domain/ic_notification.png',
SmallImageIconUrl:
'https://domain/ic_notification.png',
},
},
};
return messageRequest;
};
I searched the Internet and saw that I should use ImageUrl, ImageIconUrl, and SmallImageIconUrl, but I didn't know where to place it, so I added all 3 places.(Even when I added one each, the icon doesn't appear the same.)
But even after adding ImageIconUrl, ImageSmallIconUrl, and ImageUrl, the icon is not appearing.
And what should be the size(width, height) of each of the three icons?
If anyone has any insights on this, please let me know. I would appreciate your help.