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