Notifying users when app update is available in Windows Phone store

Ensuring that users of your app are on latest version is critically important. I have seen users reporting issues and requesting features which were implemented a few updates ago. With Windows Phone 8.1, users can enable automatic app updates installation but for users who are still on Windows 8 or who do not enable automatic updates, the responsibility is on you, as a developer.

Unfortunately, there is no support in Windows Phone SDK to find out if there is a new version of the current app in store or what version is available in store. For the converge app, I was looking to solve this issue so I traced store app’s network traffic using Fiddler to understand the available APIs. Looking at the network traffic, the API used by store app is fairly obvious. Here is the API request Windows Phone 8 store app sends for app details.

Accept: */*
Accept-Encoding: gzip
User-Agent: ZDM/4.0; Windows Mobile 8.0
X-WP-Client-Config-Version: 107
X-WP-MO-Config-Version: 1224
X-WP-Device-ID: ****
X-WP-ImpressionId: ****:API.BDIGeneric
X-WP-ImpressionK: 5

You don’t need to send all headers or parameters in requests. The response to this call has complete details for your application in the target country/language in xml format. From here on, you can use LINQ to XML to get the data you need to know what version is available in store. Here is slightly modified version of the code I use in the converge app. Feel free to reuse.

//This code has dependency on Microsoft.Net.Http NuGet package.
public async Task CheckUpdate()
    const string storeAppDetailsUri = "{0}&cc={1}&lang={2}";

    var updatedAvailable = false;

        var osVersion = Environment.OSVersion.Version.ToString(4);
        var lang = CultureInfo.CurrentCulture.Name;
        var countryCode = lang.Length == 5 ? lang.Substring(3) : "US";

        using (var message = new HttpRequestMessage(HttpMethod.Get, string.Format(storeAppDetailsUri, osVersion, countryCode, lang)))
            message.Headers.Add("User-Agent", "Windows Mobile 8.0");

            using (var client = new HttpClient())
                var response = await client.SendAsync(message);
                if (response.StatusCode != HttpStatusCode.OK) return;

                using (var stream = await response.Content.ReadAsStreamAsync())
                    XNamespace atom = "";
                    XNamespace apps = "";

                    var doc = XDocument.Load(stream);
                    if (doc.Document == null) return;

                    var entry = doc.Document.Descendants(atom + "feed")
                        .Descendants(atom + "entry")

                    if (entry == null) return;

                    var versionElement = entry.Elements(apps + "version").FirstOrDefault();
                    if (versionElement == null) return;

                    Version storeVersion;

                    if (Version.TryParse(versionElement.Value, out storeVersion))
                        var currentVersion = new AssemblyName(Assembly.GetExecutingAssembly().FullName).Version;

                        updatedAvailable = storeVersion > currentVersion;
    catch (Exception ex)

    if (updatedAvailable)

This is definitely not a documented and supported API  but considering there are millions of devices using this API, I doubt this will break in foreseeable future. I just don’t understand why Windows Phone team doesn’t make this API public and have folks build stuff on top of it. They have struggled to produce a good store experience since Windows Phone launched anyways. For Windows 8, the APIs are as useless as the store app is so don’t bother trying to do something similar there.

A side note: regardless of how good you think the updates are, don’t update the app too frequently (multiple times in a week)  if you have this notification implemented in the app. This becomes annoying and users start reporting it in reviews. This happened when I had to release multiple updates in a week to resolve content infringement complaints submitted by The Verge.

Hope this help.


Using hosts file to block Online Ads

Online ads are annoying but they make a lot of content free on web. At times I feel like I am browsing just the ads though.

There are plug-ins for Firefox and IE to block ads but I use Opera. Opera has inbuilt content blocking but that is too much to do as there are a zillion ad servers out there. At times I have to use FF or IE too and this leaves me managing three different applications to block ads. On top of that, putting a plug-in in the pipeline is again adding one more step before you can see the content. And then you have to keep updating them for new releases. Not a good idea, I’d say.

Another way is to use hosts file. Description of hosts file from wikipedia:

The hosts file is a computer file used to store information on where to find a node on a computer network. This file maps hostnames to IP addresses. The hosts file is used as a supplement to (or instead of) the domain name system on networks of varying sizes. This file is (unlike DNS) under the control of the user who is using the computer.

There is a lot of information available on internet which you can use to make it work. In a nutshell, here is what you need to do:

  1. Download a hosts file which has updated lists of ad servers. I’m using one from here and added few missing servers. Can you believe this list has around 6000 entries already? And if you follow the link, please don’t try those shock sites. 😦 More hosts files can be found here.
  2. Create a backup of your existing hosts file. (just give it an extn say .old.) On Vista, hosts file can be found in [System Drive]:\Windows\System32\drivers\etc. See this to locate on other systems.
  3. Copy the downloaded hosts file in the etc folder. If you are using the site which I did then create another hosts file in etc folder and paste the contents from browser. See this if you are trying to edit the hosts file on Vista when UAC is enabled.
  4. And that’s pretty much it. Try some ad plagued site like engadget and you should see blank space instead of ads.
  5. Also, don’t forget to update the hosts file as frequently as you can as more and more servers will be popping out every now and then.

Here are few links to learn more:


PS: The hosts file I am using and gave the link above has entries for known malware, trojans and user tracking sites too. It also has entries for ad servers like yahoo, msn and others which can make some sites behave unexpectedly. Please see inline comments on the site.

Spectacular Wallpapers from InterfaceLIFT, Tool to download them all

InterfaceLIFT is one of the best source for high resolution wallpapers out there. A lot of artists post their work on this site. Thousands of wallpapers are available to browse and download but it’s annoying to click on each one of them and save manually.

I though it would be good if I can automate this or some kind of tool that can do this for me. So yesterday night, without wasting anymore time, I decided to code one up.

Its simple. Choose the resolution you want, choose the location to want to save images to and hit “Search and Download Wallpapers”. You may also want to change the sorting to Ratings or Downloads to get community rated wallpapers first.

And here is how it works: On the website, interfacelift uses javascript to prepare the links for actual images. I checked the HTML source and thought I could exploit that approach.

  • It gets the HTML markup for first page.
  • Search for javascript method calls and get the unique identifiers for wallpapers on current page and prepare a list of actual image names.
  • Loop through all images on current page.
  • Download one at a time and save to local disk.
  • Get markup for the the next page.
  • Go to step 2.
  • Keep doing this until user hits Stop or we run out of pages.

And that’s it. Its pretty simple. I ran it on Vista and XP against .Net 2.0. You can download the independent executable and/or source (C#). See update below to download. [Independent Executable] [Complete Source Code, VS 2005]

I know it can be enhanced or made more robust. But hey I just coded it in couple of hours for the functionality I needed. I haven’t even tested it properly but it did what I was looking for.


PS. By no means its a tested and final app. I don’t take any responsibilities for the issues you may run into by using this.

Update: This program is now part of Juggler (another app I created for changing wallpapers). Please navigate to the description page to download the latest version.

Manage and configure your HDD

HDD spinning speed is one of the most important factors to increase PC throughput. Once you have a disk with good spinning speed, there are three tasks related to HDD:

1. Preparing the HDD with appropriate partitions. This can be done with windows but it cannot resize the partitions with data persistence. So, if you have to resize or split a partition without losing data, you need a specialized app.

2. Backing up the OS installation to recover if it get’s corrupted. It’s not “if” but “when” you will need this. By backing up your HDD, you can be back with stable PC within minutes after disaster.

3. Keeping the HDD de-fragmented. This is extremely important, I have seen the results of keeping HDD de-fragmented. The inbuilt de-fragmenting tool in windows isn’t enough.

So, what are the available options? The tools I have used for these are:

1. For HDD partitioning, Partition Magic is ubiquitous but I have been using Acronis Disk Director Suite. The UI is more sophisticated and this allows you to split even the system partition.

2. For HDD backup and imaging, Acronis True Image works seamlessly. Click here if you want see it’s comparison with Ghost by someone who used Ghost extensively.

Both of these applications can either be used from within Windows, or used as standalone tool without any operating system. The standalone tools are built on top of a compact Linux kernel and provides comprehensive windowed UI.

3. And finally, for de-fragmenting HDD, Diskeeper is amazing. It keeps your HDD healthy by scheduled and background de-fragmentation. Don’t forget to read the myths about fragmentation on Diskeeper site.

My experience with all three is excellent and I highly recommend them. All of them are $50 each but Newegg will give around 40-50% cheap. Though Acronis apps are as per your needs, Diskeeper is a must have.