我使用的是針對android和ios的Amazon SNS Mobile Push Notifications。我發送帶有文本和圖標的推送通知非常成功。現在我正在嘗試發送圖像底部的通知。我搜索了每個地方,但找不到完美的文檔。任何建議請。SNS推送通知與圖像使用Node.js?
我用npm安裝了這個包,我用它發送推送通知。請參考此鏈接。 https://www.npmjs.com/package/sns-mobile
AWS_SNS_App.getUsers(function (err, allDevices) {
if (err) {
console.log(err, err.stack); // an error occurred
} else {
if (allDevices.length != 0) {
var totalDevices = 0;
for (var i = 0; i < allDevices.length; i++) {
totalDevices = totalDevices + 1;
AWS_SNS_App.sendMessage(allDevices[i].EndpointArn, message, function (err, messageId) {
if (err) {
console.log('An error occured sending message to device %s');
res.send(err);
} else {
//res.send('Successfully sent a message to device , MessageID was : ' + messageId);
}
});
}
if (totalDevices === allDevices.length) {
res.send('Successfully sent a message to all devices');
}
}
}
});
的sendMessage(endpointArn,消息,回呼)將消息發送給用戶。 消息參數可以是字符串,也可以是下面格式爲 的對象。回調格式是回調(err,messageId)。
來自docs它表示要發送endpointArn消息,我們將得到任何響應的回調。我想發送圖像和圖像一起,是可能的或任何其他方式來做到這一點。
謝謝。
你是指MMS消息? Android/iOS推送通知是否支持發送圖像? –
不,我不是指MMS消息。 –
我編輯了我的問題 –