I'm trying to send a push notification from a Java server to our Corona-based mobile client. I want to have custom fields in the call.
I'm using the following (javapns library)
String rawJSON = "{\"aps\": {\"badge\": 10,\"alert\": \"test\",\"sound\": \"cat.caf\"},\"custom\":{\"id\":8}}";
PushNotificationPayload payload = PushNotificationPayload.fromJSON(rawJSON);
This is the json I'm sending in the above:
{
"aps":{
"badge":10,
"alert":"test",
"sound":"cat.caf"
},
"custom":{
"id":8
}
}
For some reason, it doesn't arrive in the custom field.
Can anyone help me with an example for such json that needs to be sent ?
Thanks in advance !
you can just use
PushNotificationPayload payload = PushNotificationPayload.complex();
payload.addAlert("Hello World!");
payload.addCustomDictionary("mykey1", "My Value 1");
payload.addCustomDictionary("mykey2", 2);
exactly as instructed at javapns
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With