简体   繁体   中英

how to set up azure mobile service to deliver periodic updates to a windows 8 (store) App?

I want to add periodic tile updates to my windows store App, everything works ok if I provide a xml to the tileUpdateManager like for example this address http://wowzappelsalvador.azurewebsites.net/tiletest.xml . The app works with an azure mobile service and the idea is to have the App tile updated using the same service so I created a read script on azure like this:

function read(query, user, request) {

mssql.query("select imagenTile, nombreTip from verdetips.tipDiaLiveTileView", {
    success: function(results) {

        var xmlEscape = function (text) {
        return text.replace(/&/g, '&')
           .replace(/</g, '&lt;')
           .replace(/>/g, '&gt;')
           .replace(/"/g, '&quot;');
        }

         var payload = "<?xml version='1.0' encoding='UTF-8'?>" +
         "<tile><visual><binding template='TileWideImageAndText01'>" +
          "<image id='1' src='" + xmlEscape(results[0].imagenTile) + "' alt='Verde Tips'/>" +
          "<text id='1'>" + xmlEscape(results[0].nombreTip) + "</text>" +
          "</binding>" +
          "<binding template='TileSquareText04'>" +
          "<text id='1'>" + xmlEscape(results[0].nombreTip) + "</text>" +
          "</binding></visual></tile>";

         console.log(payload);
         request.respond(statusCodes.OK, payload);
    }
 });
}

when I call the table associated with this script I get the same text as on the .xml file but on a .json file and the tile update doesn't work, what am I missing?

Note: I've seen some sites explaining how to use push.wns.send on azure mobile services to send push or toast notifications but my case is a polled notification, client code as follows:

var notifications = Windows.UI.Notifications;
    var polledUri = new Windows.Foundation.Uri("http://verdetips.azure-mobile.net/tables/tipDiaLiveTile");
    //var polledUri = new Windows.Foundation.Uri("http://wowzappelsalvador.azurewebsites.net/tiletest.xml");
    var recurrence = notifications.PeriodicUpdateRecurrence.daily;
    var tileUpdater = notifications.TileUpdateManager.createTileUpdaterForApplication();
    tileUpdater.startPeriodicUpdate(polledUri, recurrence);

Any help would be much appreciated!

At the moment Azure Mobile Services don't have the capability of returning anything other than JSON. This is a recurrent request, so this feature is in the roadmap and should be implemented in the near future.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM