Page 1 of 1

Push Notification to single device

Posted: Wed Apr 30, 2014 2:36 pm
by RodrigoD

I am tying to send a notification to a single device and its not working.
Here is the json I am using:
{"payload":{"message":"Notification sample","badge":0},"status":"sent","filter":{"deviceId":""}}

I got the deviceId from the devices table. When I remove the filter I get the notification.


Push Notification to single device

Posted: Wed Apr 30, 2014 2:41 pm
by RodrigoD

Well , it was a problem with my Json parser.
the json shoud be:
{"payload":{"message":"Notification sample","badge":0},"status":"sent","filter":{"deviceID":""}}

And here is my small .net code to send notifications
Fell free to add to tutorials.

string url = "https://api.appery.io/rest/push/msg";

Code: Select all

         using (WebClient client = new WebClient()) 
         { 
             client.Headers.Add("X-Appery-Push-API-Key", pushApkiKey); 
             client.Headers[HttpRequestHeader.ContentType]= "application/json"; 

             var responsebytes = client.UploadString(url, "POST",jsonString); 

         }

Push Notification to single device

Posted: Wed Apr 30, 2014 2:49 pm
by Maryna Brodina

Hello!

Thank you for update!