DZone
Mobile Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Mobile Zone > Periodic Live Tile Updates with Windows 8

Periodic Live Tile Updates with Windows 8

Mikael Koskinen user avatar by
Mikael Koskinen
·
Jun. 19, 12 · Mobile Zone · Interview
Like (0)
Save
Tweet
3.68K Views

Join the DZone community and get the full member experience.

Join For Free

One small tip if you’re creating a Windows 8 Metro app and want to update the live tile periodically using the TileUpdater-class: The request made by the OS for the live tile update doesn’t set the Content-Type so make sure that you backend is actually returning XML by default.

image

I encountered this when I built my app’s backend using ASP.NET Web Api and noticed that the live tile updates weren’t actually working. The backend was returning JSON instead of the XML because that’s the default format for the Web Api. In my case the backend only serves the live tile updates so I completely removed the JSON-formatter:

var config = new HttpSelfHostConfiguration("http://localhost:8080");
 
config.Routes.MapHttpRoute("Default", "api/{controller}/{id}",
    new { id = RouteParameter.Optional });
 
config.Formatters.RemoveAt(0);
 
using (var server = new HttpSelfHostServer(config))
{
    server.OpenAsync().Wait();
 
    Console.WriteLine("Press Enter to quit.");
    Console.ReadLine();
}

Now the backend is returning XML and the periodic live tile updates work properly.

Web API app XML ASP.NET JSON Requests

Published at DZone with permission of Mikael Koskinen, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Kotlin Was Predicted to Overtake Java by December 2018. What Happened?
  • What Happened to HornetQ, the JMS That Shattered Records?
  • Open API and Omnichannel with Apache Kafka in Healthcare
  • IntelliJ Integration for Mockito

Comments

Mobile Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo