Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am sending periodic notifications from azure mobile services with the help of API,

I have to sent queue of notifications but the below code returns only sent one notification

How to make this code to send queue of notifications in single xml file

JavaScript
exports.get = function(request, response) {
    var wns = require('wns');    
    var tileType=request.query.tileType;
    var todoItems = request.service.tables.getTable('place');
    todoItems.where({
        uniqueid:request.query.itemId
    }).read({
        success: sendResponse
    });


function sendResponse(results) {
    var tileText={
        text:""
    };
    var xml;
    var i = 0;
    console.log(results)
    results.forEach(function(item) {
       
        tileText["text" + (i + 1)] = item.title+", "+item.subtitle;
        
        tileText["image"+(i+1)+"src"]=item.imagePath;        
        i++;
    });
   
   if(tileType!="Wide")
   {
       xml = wns.createTileSquarePeekImageAndText04(tileText);
      
   }else
   {
        xml = wns.createTileWideImageAndText01(tileText);
   }
  
    response.set('content-type', 'application/xml');
    response.send(200, xml);
}


};


and i have 5 items to come as notifications for that i am taking foreach and caling five times the service but the queue is not working, here i am calling service two times one is for wide tile and another is for square tile notifications like below in app.cs file

C#
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
                            foreach (var item in itms)
                            {
                                TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(
                                    new System.Uri(App.MobileService.ApplicationUri, "/api/tiles?itemId=" + item.UniqueId ),DateTimeOffset.UtcNow.AddSeconds(1),
                                    PeriodicUpdateRecurrence.TwelveHours);
                                TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(
                                   new System.Uri(App.MobileService.ApplicationUri, "/api/tiles?itemId=" + item.UniqueId + "&tileType=Square"),
                                   PeriodicUpdateRecurrence.HalfHour);
                            }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900