Push Notification Bad Request

6 posts, 1 answers
  1. Bruce
    Bruce avatar
    38 posts
    Member since:
    Oct 2009

    Posted 17 Sep 2013 Link to this post

    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();

  2. Bruce
    Bruce avatar
    38 posts
    Member since:
    Oct 2009

    Posted 17 Sep 2013 Link to this post

    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
  3. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 18 Sep 2013 Link to this post

    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.
  4. Bruce
    Bruce avatar
    38 posts
    Member since:
    Oct 2009

    Posted 18 Sep 2013 Link to this post

    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
  5. Answer
    Lyubomir Dokov
    Admin
    Lyubomir Dokov avatar
    43 posts

    Posted 23 Sep 2013 Link to this post

    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.
  6. Bruce
    Bruce avatar
    38 posts
    Member since:
    Oct 2009

    Posted 24 Sep 2013 Link to this post

    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
Back to Top