Implementing an “App News” Live Tile in Windows Phone 8

Even if your app doesn’t have frequently updating content, it is easy to implement a cool live tile for your Windows Phone 8 app if you have a twitter account.

One of the coolest features of Windows Phone since Windows Phone 7 was initially released is that of Live Tiles for apps that are pinned to the phone’s start screen. With Windows Phone 8 implementing live tiles is both easier and provides a wider range of functionality than ever.

The Windows Phone 8 API provides developers with access to three different types of Tiles:

  1. Flip Tiles
  2. Cycle Tiles
  3. Iconic Tiles

In this article, we are going to implement a Live Flip Tile. Information on the other two tile types is available in the API documentation here.

So I will assume that you have already written a killer Windows Phone 8 app. And you know that all the really cool apps use live tiles, but maybe your app doesn’t present the type of frequently updated data that would work well in a live tile, and you just don’t know if a live tile would work for your app. Well, wouldn’t it be nice if your users could see the latest news about your app (such as updates submitted, new features, bugs, etc) from a quick glance at a live tile? All you need to implement that functionality is a twitter account and a unique hashtag for your app. The code that implements the live tile in your app is super easy. Let’s get started.

Step 1: Twitter
You’re a developer. You already have a twitter account. Done.

Step 2: Post an Update
I will assume you have more than one Windows Phone app, but whether you do or not, you will want to come up with a unique hashtag to target tweets to a specific app. For example, in this demo, I am working with my app called To target tweets from my timeline to this app I include the hashtag #cameronheadcoversapp. Yes that is a long hashtag and it eats up a bit of my 140 characters but it hasn’t been an issue for me yet. You can always choose a shorter hashtag if you wish. So here is my latest app update tweet for

Now that I have tweeted an update for my app let’s get into our app.

Step 3: App properties and Tile images
Before we get into writing some code, there are a few properties we need to make sure are set and some image assets we need to add to the app. There are three sizes of tiles supported by Windows Phone 8 and you should supply an image to support all three (Small, Medium, and Large or Wide). The dimensions for these tiles is as follows:

Small: 159px X 159px
Medium: 336px X 336px
Large or Wide: 691px X 336px

If you created your app new as a Windows Phone 8 app, you should already have placeholders for these in the Assets/Tiles folder. If you upgraded your app to Windows Phone 8 from Windows Phone 7.0 or 7.1, I would suggest adding that folder and placing your tile images there.

Double-click the WMAppManifest.xml file in your app and on the Application UI tab you will see the following:


Make sure to select TemplateFlip for the Tile Template, and select your three tile images where appropriate.

Step 4: Scheduled Task Agent
In order to update your Live Tile, your solution needs a Scheduled Task Agent project added to it. Right-click your solution, click “Add”, then “New Project”. From the Add New Project window, click Windows Phone on the left and select the Windows Phone Scheduled Task Agent project type. Specify a name for the project and click OK.

The Scheduled Task Agent includes one code file – ScheduledAgent.cs, with one method that we care about – OnInvoke.

OnInvoke is where we will place our code to provide updated data to our live tile. This process basically involves only three steps:

  1. Retrieve a reference to our app’s pinned tile
  2. Retrieve your twitter feed and search for a relevant update
  3. Create a new FlipTileData object, set the properties and pass it to the app’s pinned tile

Before we start coding, make sure you add a reference to the following assemblies in ScheduledAgent.cs:

  • System.Linq
  • Microsoft.Phone.Shell

First, let’s grab the app’s pinned tile:

ShellTile appTile = ShellTile.ActiveTiles.First();

You next want to retrieve your twitter feed. I have written my own twitter helper, but you can accomplish this easily using a library such as Linq2Twitter.

List listItems = await AndrewLong.WindowsPhone.Helpers.Twitter.SearchHelper.GetSearchResults(

Next, I check to see if there is a tweet found to put on the live tile or not. Either way, I am going to create a new FlipTileData object and pass it to the tile:

tileData = new FlipTileData()
BackContent = listItems[0].ItemText,
BackTitle = "App News",
Title = "",
WideBackContent = listItems[0].ItemText


Finally, in a Scheduled Task Agent, you want to make sure you always make a call to


Now let’s go back to our Phone App project.

Step 5: Updating your App project
All that is left now is to add some code to your phone project so that it sets up your Scheduled Agent to run.

Since you don’t know if your app is pinned to the start screen or not, it makes sense to try to schedule your agent every time the app runs.

Setting up the scheduled agent is done with the following code:

PeriodicTask tileUpdaterPeriodicTask;

string taskName = "LiveTileUpdater";

tileUpdaterPeriodicTask = ScheduledActionService.Find(taskName) as PeriodicTask;

if (tileUpdaterPeriodicTask != null)

tileUpdaterPeriodicTask = new PeriodicTask(taskName);
tileUpdaterPeriodicTask.Description = " Tile Updater";


All this code does is search for an existing instance of our Agent running in the Scheduled Action Service. If it finds one, we are going to remove it so we can create a fresh instance. We then create the new instance of the Agent. After we add our agent to the Scheduled Action Service, we use the development-only call of ScheduledActionService.LaunchForTest. This allows us to immediately kick off execution of our agent so we can step through and debug the code if necessary.

Step 6: Live Tile Magic
Once all this is done, it is time to run our app. Assuming you are still in the development environment and running in the emulator, you will need to run the app twice before you start seeing your live tile updates. That is because you can’t pin the app to the start screen until it runs the first time after being deployed to the emulator from Visual Studio. So, after you have pinned your app to the emulator’s start screen and fire up the app again, you should start seeing your live tile in action like so:

TileFront TileFlipped

As you can see, adding cool live tile functionality to your Windows Phone 8 apps is very simple and is a great way to keep your users informed and engaged with your apps.

Good luck.

Posted in Windows Phone, WP8 | Tagged , , , , | 5 Comments

The perils of relying on 3rd-party APIs

As I assume is the case for most developers of mobile apps, we spend a lot of our development time working with 3rd-party API’s.  I know with my apps I use API’s from FourSquare, YouTube, the FAA, Bitly, Groupon, the NY Times and Sunlight Labs among others.

One of my Windows Phone apps – AirportStatus – uses the Bing Instant Answers API to provide flight status information.  Errr… it used to, before Bing discontinued the Instant Answers API on December 9th.

And the timing couldn’t be worse.  AirportStatus was recently named a winner in Microsoft’s “Your App Here” contest, meaning it was awarded a 1,000,000 impression ad campaign across the MSN websites during December as well as featured placement in the Marketplace on December 22nd.

So problem #1 for me is anyone that downloads AirportStatus is going to end up with only a partially-functioning app, and probably a diminished view both of the Windows Phone platform (“hey, I downloaded this app because of a Microsoft ad on MSN”), and me as an app developer.

Problem #2 is that once (if) I can find a replacement service to provide flight data for AirportStatus (Bing’s API was free, while other services are not, and I would like to keep AirportStatus as a free app), it will still be a lengthy time period before I can update the app to use the new provider and another week or so to get the app update approved through the marketplace, then users will have to download the update to once again have a working version of AirportStatus.

The big lesson here for mobile app developers is that you have to build your own services on top of any 3rd-party API you use.  I started learning this lesson a while ago, but hadn’t yet implemented my own service for the flight status data.  The drawbacks to doing this are obvious – a performance hit by adding another layer to your data stack, as well as the additional work involved in building your own service.  But I believe ultimately the benefits outweigh those drawbacks:

  • Centralized data caching, reducing your overall API calls
  • Simplified API access: Some 3rd-party API’s can be a bit, um, painful to work with. Building your own service layer on top can make things easier on the clients you are building
  • If you are doing cross-platform development (WP7, iOs, Android, etc), the benefit of simplified API access really comes into play
  • If a provider changes (or heaven forbid) discontinues an API you can have your apps working quicker and w/o requiring the user to download an update just by updating your service

Have you had an experience where a 3rd-party API change broker your app?  Let me know how you handled it or how you architect your apps to plan for possible 3rd-party API changes in the comments below.

Posted in Computers and Internet, WP7 | 1 Comment

WP7 Mango SDK AdControl Bug

I’ve recently had an issue getting an update to one of my apps through certification.  The problem reported by testing was that the app did not resume properly. For the life of me I could not re-create the issue until I re-read the reported steps to re-create it. It said after launching the app to quickly push the start button to exit.

I started to notice that if I pushed the start button before the ad control had a chance to finish loading the first advertisement, then tried to resume the app that indeed the app would not resume successfully.

In the video below I demonstrate this using the Mango AdControl sample downloaded from MSDN.  You’ll notice in the video that I have to push the start button very quickly to reproduce the error. I believe that is mainly because I am running in the emulator over my home’s high-speed connection, and the ad control is setup in test mode.  But imagine a real-world scenario where the phone is running on a 3g or slower connection and you can see where the issue could crop up easier.

I have tried to reach out to members of the WP7 team via Twitter to try to bring this issue to someone’s attention with no luck.  If anybody out there has any ideas about why this is happening or suggestions on how to work around it I would love to hear from you.

Posted in WP7 | Tagged , , , , | Leave a comment

Windows Phone Mango Compass v1.2 Preview

Much to my (pleasant) surprise, my app Mango Compass, which just dropped in the Windows Phone Marketplace about a week ago, has turned into a bit of a hit, with downloads far exceeding any expectations I had for it.

Feedback and reviews have been overwhelmingly positive as their seems to have been quite a bit of pent up desire amongst Windows Phone users for this simple functionality.

There has also been some good constructive criticism particularly around the apps look and feel, which quite frankly is pretty boring and doesn’t really fit the Metro style.

So while version 1.1 is currently making its way through the approval process with a couple updates, here is a preview of what will be coming in version 1.2:

Posted in Computers and Internet, WP7 | Tagged , , , , | 1 Comment

Tiger Woods is a Man With a Plan

Tiger Woods has a plan and I’m surprised no one (that I know of) from the mainstream golf media has figured it out yet.

We all know Tiger’s main plan, to better Jack’s record of 18 major championships, but I have no doubt that deep down, Tiger wants to win every conceivable award there is in the world of golf.

To my knowledge there is really only one award thus far that he hasn’t won which his poor play and personal and health problems have now opened the door for him to win in 2012.

I am speaking of course about the Comeback Player of the Year.  Tiger is in perfect position to win this award in 2012.  Just consider the following reasons:

  1. He will have had considerable time to get totally healthy since he injured himself at Augusta in April.
  2. He will have also had considerable time working with Sean Foley to get whatever his new new swing ingrained.
  3. He will be 36 next year which should put him very much still in the prime of his career.
  4. His personal issues seem to be long behind him – at least the divorce from Elin is getting further and further in the rear-view mirror.
  5. His issues with sponsors seems to be looking up as evidenced today by his new endorsement deal with Rolex. Thankfully Tiger won’t have to worry about grinding out cuts to put food on the table, he can play a little more relaxed.

So my expectations from Tiger for the rest of this year are fairly modest.  Make the cut this week at the open, maybe a top-25 finish.  Solid but not spectacular play at the President’s Cup – just good enough to justify his good buddy Fred Couples’ Captain’s Pick, but not so good that everybody starts claiming “Tiger’s Back!”.

Next year at San Diego, or wherever Tiger decides to kick off his season, watch out, because Tiger will be a man on a mission.

Of course, even after Tiger wins the Comeback POY award next year, he will still be 1 behind Steve Stricker, so we may have to do this all over again in a few years.

Posted in Golf | Tagged , , , | Leave a comment

Just a note about the “Mango Compass” Windows Phone app

My new Windows Phone 7 app “Mango Compass” was recently published into the marketplace. I have seen a few reviews saying simply that the app “doesn’t work”.

It is important to note that you must be running your carrier’s official Mango update to have all the necessary drivers on your phone for the built-in compass (which this app utilizes) to function properly.  If you installed Mango build 7720 by another method – such as the “trick zune” process – you probably do not have the required compass drivers, and the app will not work as expected.

You can refer to these two pages from Microsoft:

to get a better idea of if your phone has the necessary compass drivers. Very simply, if your carrier or phone is not listed as “Delivering Update” then the compass drivers for your device are not yet ready, and were not included in your Mango download.

So for example, in the US, the HTC HD7s, Dell Venue Pro and Samsung Focus v1.4 are not currently receiving the Mango update, while in the rest of the world, the Samsung Omnia 7 in France and on Deutsche Telekom, as well as all WP7 devices on Telefonica in Spain are not yet receiving the Mango update.  If you have one of these devices/carriers, Mango Compass will probably not work for you… Yet.

Posted in WP7 | Tagged , , , , | Leave a comment

Gratuitous with Augmented Reality Functionality Approved For WP7 Marketplace

After a few cosmetic improvements with the augmented reality functionality, my tip calculator/foursquare client/yelp review search app Gratuitous has been approved for the Windows Phone Marketplace.  Version 2.0 should be visible and available for download sometime in the next 24 hours.

Remember, it is not enough to just have a device running Mango to view the augmented reality functionality.  Your phone must have either a gyroscope (such as the HTC Mazaa) or the necessary compass drivers to enable the Motion API.  My understanding is that those compass drivers will not be available on first gen devices such as the Samsung Focus, HD7 and LG Quantum until build 7720 is released by the hardware manufacturers and carriers.

Posted in Augmented Reality, WP7 | Tagged , , | Leave a comment

More Augmented Reality in Windows Phone 7.5 Mango

A couple weeks ago I posted about augmented reality functionality that I was working on adding to my tip calculator/foursquare client app “Gratuitous”.  I wanted to share another video with you all of what I am working on with my parking reminder app “Park It”.

Version 2.0 of Park It is available now in the marketplace and includes some nice Mango features such as Live Tile support and integration with Bing Maps turn-by-turn voice directions.

Version 2.1 will look a little like this…

And yes, I did take the video with an iPhone 4, but it takes great video, and it would’ve been really difficult to take video with the same WP7 device I was using to run the app now wouldn’t it?

Posted in Augmented Reality, WP7 | Tagged , , , | Leave a comment

Augmented Reality in Windows Phone 7.5 Mango

One of the cool scenarios enabled by Windows Phone 7.5 Mango is augmented reality.  The Motion API and direct access the the camera stream enable these scenarios for Windows Phone developers.  For more information on these API’s check out the MSDN augmented reality sample here –

The Motion API gathers data from the device’s compass, accelerometer and gyroscope, but the good news for owners of first generation Windows Phone devices is that a phone only needs to have two of these sensors available (the compass and accelerometer for first gen devices) to enable the Motion API.

I’ve started working on adding augmented reality functionality to some of my apps.  Here is a little preview of what is coming in Gratuitous, a combined tip calculator and foursquare client:

Posted in Augmented Reality, WP7 | 12 Comments

Unexpected errors in rGov Congress WP7 app

If you are a user of my rGov Congress app for Windows Phone 7, you may have recently experienced the app terminating unexpectedly.  Because of the increased popularity and number of users of the app, we are hitting the limit of the number of calls we are permitted on one of the APIs we are using.  We are trying to work with that API vendor to increase our call limit, and also examining the app code to determine if we can reduce the number of calls that we make.  In the mean time, thank you for your patience and I hope you continue to use the rGov Congress app.


Posted in WP7 | Leave a comment