This is a migrated thread and some comments may be shown as answers.

Push Notification Bad Request

5 Answers 107 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bruce
Top achievements
Rank 1
Bruce asked on 18 Sep 2013, 02:33 AM

All,

I am trying to send push notifications from my ServiceStack Rest API using the .NET 4.5 SDK. The following is my filter, but I keep getting a bad request returned. From what I can tell in the docs, this is a legitimate filter string. Can anyone please shed some light on this and clue me in to what I am missing?

Thanks,
B


string Filter = "{
    '$or': [{
        'PushToken': '505f4a4a18897b7d7101f0d2'
    }, {
        'PushToken': '454180c04996bb896a97334f6816a502ed9e813b302add8becb5bf9d137f2c21'
    }]
}";
EverliveApp elApp =
new EverliveApp(ELAPIToken);
var notification = new PushNotification(payload);
notification.Filter = Filter;
elApp.WorkWith().Push().Notifications().Create(notification).ExecuteSync();

5 Answers, 1 is accepted

Sort by
0
Bruce
Top achievements
Rank 1
answered on 18 Sep 2013, 02:47 AM
All,

I managed to fix the bad request by replacing my single quotes with escaped double quotes per the documentation. My only remaining question at this point is how to correctly filter on device token instead of userid. I can see the filter successfully on the server when I use the UserID, but I want to filter on PushToken instead. Any suggestions?

Thanks,
B
0
Steve
Telerik team
answered on 18 Sep 2013, 03:28 PM
Hi Bruce,

Check the answer in this forum post for more information. You can replace HardwareId with PushToken as they're both device registration properties.

Regards,
Steve
Telerik

Big news for mobile app and .NET developers! Hear about it at our Release Keynote. Thursday, September 26th, 11AM EDT
Do you enjoy Icenium? Vote for it in Windows IT Pro Community Choice Awards as Best Cloud Computing Product or Service (Category 5).
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Bruce
Top achievements
Rank 1
answered on 18 Sep 2013, 03:54 PM
Hi Steve,

Thanks for the reply. I am not sure what went awry last night, but later this morning when I changed my filter back to PushToken and executed my trigger, there was my notification on my phone.

I am getting an error when I receive the notification while the app is running, so I know it is an issue with the iOS callback. Unfortunately I can't step it, because the push notifications only work on AdHoc release, and stepping code only works with Dev release. I'll figure it out at some point...

I am now only a few steps away from an open-source Everlive backed GeoLocation engine that sends push messages based on entering and exiting app-user defined areas. The .NET SDK was a huge help in my REST API since I was trying to use RestSharp to send a REST call and it kept blowing up. 

 As soon as it is complete, refactored, and tested, I'll send you folks the link. I'd love to see other Icenium/Everlive users using it for geofencing as an alternative to plugin-based geofencing.

Thanks,
Bruce
0
Accepted
Lyubomir Dokov
Telerik team
answered on 23 Sep 2013, 03:58 PM
Hi,

The push notifications should work with DEV deployment as well. Please make sure that:
- you upload the DEV push certificate to Everlive and select Dev mode from the push notifications settings in your app in Everlive
- you deploy the app to the device using a DEV provision

This should do it.


Regards,
Lyubomir Dokov
Telerik

Big news for mobile app and .NET developers! Hear about it at our Release Keynote. Thursday, September 26th, 11AM EDT
Do you enjoy Icenium? Vote for it in Windows IT Pro Community Choice Awards as Best Cloud Computing Product or Service (Category 5).
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Bruce
Top achievements
Rank 1
answered on 24 Sep 2013, 07:24 PM
Hi Lyubomir,

Thanks for the reply. I am so used to running under AD_HOC I completely forgot I could set both my app and Everlive Push to DEV. 

Bruce
Tags
General Discussion
Asked by
Bruce
Top achievements
Rank 1
Answers by
Bruce
Top achievements
Rank 1
Steve
Telerik team
Lyubomir Dokov
Telerik team
Share this question
or