Getting original Payload and Custom Attributes
hanchhanch opened this issue · comments
hanchhanch commented
Hi,
How can I view custom attributes sent within the payload?
Also, is it possible to see the actual payload in the OnNotificationOpened handler? There are only some platform parameters there in the PushNotificationResponseEventArg argument
Thanks
Youcef LEBID commented
Hello, did you get an answer to your second question : is it possible to see the actual payload in the OnNotificationOpened handler?
hanchhanch commented
yes.
To send the push use this json:
{
"GCM":
{
"notification":
{
"title":"asdfasda",
"body":"adfadsf"
},
"data":
{
"custom-data-key":"custom-value"
}
},
"APNS":
{
"aps":
{
"title":"asdfasda",
"body":"adfadsf"
},
"data":
{
"acmecustom-data-key":"custom-value"
}
}
}
For Apple Push Notification, note that the custom keys need to be prefixed with 'acme'
The following handler will have the custom keys in the 'p' argument
CrossPushNotification.Current.OnNotificationOpened += (s, p) =>
{
Utils.MiscUtils.HandleNotification(s, p.Data);
};