How to make different queues in pushsharp

Like If my client subscribe for two difference services i.e. sports, Lifestyle

I need to push different notifications to same client with same title but different groups

group 1 - sports
group 2 - Lifestyle

thanks

Posts

  • IvanHarrisIvanHarris USMember ✭✭✭
    edited April 2013

    You looking for code for the server or the app?

    Just send a different key/value pair.

    Below is sample code that will push the key/value pair to your app (from the server):

    string message = "group";
    string alertValue = "sports";
    push.QueueNotification(android.WithJson("{ alert : " + message + ", alertValue: " + alertValue + " }"));
    

    //OR

    string message = "group";
    string alertValue = "lifestyle";
    push.QueueNotification(android.WithJson("{ alert : " + message + ", alertValue: " + alertValue + " }"));
    

    Then within the app, read the key/value pair and send different notifications based on the pushed value.

    Make sense?

  • Nick_chdNick_chd INMember

    Thanks Ivan,

    I have tried this code, but it is pushing notification as one group only.
    I need to have different notification for respective groups.
    app
    if two different notification forward for different group then two notification should
    be appear on client handset

  • IvanHarrisIvanHarris USMember ✭✭✭
    edited April 2013

    How about this then? :)

    string message = "group1";
    string alertValue = "sports";
    push.QueueNotification(android.WithJson("{ alert : " + message + ", alertValue: " + alertValue + " }"));
    

    OR

    string message = "group2";
    string alertValue = "lifestyle";
    push.QueueNotification(android.WithJson("{ alert : " + message + ", alertValue: " + alertValue + " }"));
    

    All I did was change the "message" string (key) to either pass group1 or group2.

  • IvanHarrisIvanHarris USMember ✭✭✭

    What I believe you want to do is this right?

    //group1 is sports
    //group2 is lifestyle
    string message = "group1";
    string alertValue = "Steelers are up 30 to 7 over the Browns!";
    push.QueueNotification(android.WithJson("{ alert : " + message + ", alertValue: " + alertValue + " }"));
    

    or

    string message = "group2";
    string alertValue = "Walking increases blood flow to the heart.";
    push.QueueNotification(android.WithJson("{ alert : " + message + ", alertValue: " + alertValue + " }"));
    

    Does that work for you now?

  • Nick_chdNick_chd INMember

    Above code is giving error "Invalid JSON"

    This code might be working in iPhone but it is not working in Android

    currently I am using this:

    .WithJson("{\"message\":\"" + string.Format(PUSHNOTIFICATION_MESSAGE, ShortText, message) + " ! - " + timeStamp + "\", \"title\":\"G2 feedback!\",\"msgcnt\":\"1\", \"badge\":\"7\"}"));

    Here I want to know the which tag need to be added that can group the notifications.

    "alertValue" is not working here

Sign In or Register to comment.