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.

GET http://marketplaceedgeservice.windowsphone.com/v8/catalog/apps/b658425e-ba4c-4478-9af3-791fd0f1abfe?os=8.0.10521.0&cc=US&lang=en-US&hw=520208901&dm=RM-940_nam_att_200&oemId=NOKIA&moId=att-us&cf=99-1
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 = "http://marketplaceedgeservice.windowsphone.com/v8/catalog/apps/b658425e-ba4c-4478-9af3-791fd0f1abfe?os={0}&cc={1}&lang={2}";

    var updatedAvailable = false;

    try
    {
        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 = "http://www.w3.org/2005/Atom";
                    XNamespace apps = "http://schemas.zune.net/catalog/apps/2008/02";

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

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

                    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)
    {
        // HANDLE ERROR HERE. THERE IS NO POINT IN SHOWING USER A MESSAGE. GOOD PLACE TO SEND SILENT ERROR REPORT OR JUST SWALLOW THE EXCEPTION.
        Debug.WriteLine(ex);
    }

    if (updatedAvailable)
    {
        // APP UPDATE IS AVAILABLE. SHOW FIREWORKS IN APP OR JUST OPEN STORE APP TO UPDATE THE APP AFTER USER'S CONSENT.
    }
}

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.

Advertisements

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:

Enjoy!

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.

WallpaperCrawler.exe.zip [Independent Executable]

WallpaperCrawler.source.zip [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.

Enjoy!

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.

Vladstudio Wallpaper Collection (Updated)

Ever wondered how can you get high quality wallpapers for your desktop with matching resolution? Out of lots of sources in today’s community driven web, one I am a fan of is Vladstudio.com. You can get wallpapers with signature for free and high quality signature free wallpapers with a paid subscription.

Previews:

I paid for the life time subscription and it seems I can share the amazing art work with friends, which seems OK as per his copyright terms.

…… By visiting Vladstudio.com you are granted a personal license to download and use the files on your personal computer and to share them with your friends and family…..

I also found these direct links for all wallpapers which you can download without subscription. Click on the links (hosted on his server) for your desktop resolution. YOU WILL NEED TO BUY PREMIUM MEMBERSHIP TO DOWNLOAD THE ZIP FILES.

You can download all-in-one zips packs for all possible resolutions. Obviously, downloads are only available to registered users.

More download links:

  1. InterfaceLIFT. Or use this tool I created if you don’t want to save more than a thousand images one by one.
  2. Hamad’s Vista Wallpaper Pack. Hamad was hired by Microsoft to shoot wallpapers for Windows Vista. He shot handful of ’em but only a couple made it to the final Vista installation disk. These are only available in 1900×1200.
  3. Mike Swanson’s Wallpaper Collection. Most of these are flowers and leaves. You can feel a little overwhelmed if you are not a nature freak like me. Only available in 1920×1200 and 1600×1200.

Enjoy!

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? Well, let’s keep it to the solution instead of comparing products here. Lately, I have being using three applications for each of the tasks mentioned.

1. For HDD partitioning, Partition Magic is ubiquitous but I have been using a better app named 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 has a great app named Acronis True Image. This works seamlessly. Click here if you want see it’s comparison with Ghost by someone used Ghost extensively.

Both of these applications can either be used from within the 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 window based UI.

3. And finally, for de-fragmenting HDD, first and only thing which comes in mind is Diskeeper. This application 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. Your HDD will thank you every time Diskeeper will arrange bits on that platter surface.

itasveer! Online photo printing service

I have been using an online photo printing service for quite some time for sending photos back home. So, I upload photos from here and they deliver in India. 🙂 Kewl? You can upload and get the photos delivered in most of the metros.

No marketting! I am just trying to get some customers for them so that they don’t close the site due to lack of business. 🙂 Jokes apart, I thought this may also be useful for you. I know its a bit painful to go to Print Shop everytime. The quality is quite good at throw away rates. There might be some other sites but I have no idea about that. Please post if we have other options too.

Go on… use this good service.

http://www.itasveer.com