ken lee
ken lee

Reputation: 275

How to push toast notification from Azure mobile service

I am developing an app to receive toast notification whenever the database is updated, but i want the server to push the notification to one specific user only not all.

Any way of doing it?

function update(item, user, request) {
    request.execute({
        success: function () {
            // Write to the response and then send the notification in the background
           request.respond();           
           push.mpns.sendToast(item.channel,
           {
               text1:"Sent from cloud!"
           },
           {
             success: function(pushResponse) {
              console.log("Sent push:", pushResponse);
            }  
           });                  
        }
    });
}

Upvotes: 0

Views: 624

Answers (1)

carlosfigueira
carlosfigueira

Reputation: 87218

What you need to do is to store the channel URLs associated with the users in your system in a table, and once you're ready to push to a certain user, query that table based on the user you want to send the notification to, and use the channel you retrieve.

The tutorial at http://www.windowsazure.com/en-us/develop/mobile/tutorials/push-notifications-to-users-wp8/ shows one way of implementing this logic.

Upvotes: 1

Related Questions