Implementation of Amazon SNS push notification to android device using aws-sdk package in NodeJS. I have few implementations mentioned below. Mobile device is displaying push notifications. I want to send data and notification object in payload.
let payload2 = JSON.stringify({
default: 'Naresh',
GCM: JSON.stringify({
notification : {
body : 'great match!',
title : 'Portugal vs. Denmark'
},
data:{
testdata: 'Check out these awesome deals!',
url: 'www.amazon.com'
}
})
});
It's not sending push notifications.
let payload1 = {
"GCM": "{
\"notification\": {
\"title\": \"this one last test in app\",
\"body\": \"mm hello tests\"
},
\"data\": {
\"turnclass\": \"efwfwe\",
\"flight\": \"truejet\"}
}"
};
It's sending push notifications.
sns.publish({ TargetArn: targetArn,
Message: payload1,
MessageStructure: 'json'
}, (error, data) => (error) ? reject(error) : resolve(data));
What is right format to send push notifications?