Google+ Followers

27 Jan 2014

Windows Phone 8 App Development Part-3: Testing/Publishing

This post is part-3 of the article on windows phone 8 app developments -  Quick Start-up guide with best practicesThis whole series is in 3 parts:
Part-1: Planning and Environment Setup
Part-2: App Development, best design practices, and some challenges 
Part-3: Testing/QA of the App and the process of publishing it to store

In case if you haven’t checked the part-1 and part-2, I strongly recommend you to go through them first. 

Now I will discuss about the testing/QA challenges and the process of your app certification and publication to windows phone store.


Through Emulator: Emulator is a virtualized environment in which you can debug and test Windows Phone apps without a physical device. The default emulator image in Visual Studio is 'Emulator WVGA 512MB'. This default selection targets the largest possible market.  Emulator is used continuously for testing during development or QA. 
Various emulator options: 

With real phone device: Although emulator provides a comparable performance to a real device, I strongly recommend you to test your app on multiple devices (like 1 high end-Lumia 920 and 1 low end - Lumia 520). 
Even I found some differences between emulator and device such as problem in detecting network or limitations with memory utilization issues. The testing against device will help you to find few critical issues which may not come up in Emulator.
Deployment to a device is real easy as we just need to connect device using USB while Win 8 VM is maximized, select Device in-place of Emulator, and run/debug the App in Visual Studio. App will get installed in the device. We can also debug against the device, and there is no need to worry as nothing would happen to your phone.

Creating a developer account

You will need a paid developer account to publish your app to windows store. You can register as individual or a company. You would also need to associate a Microsoft account with this developer account. Following are the differences between individual and company account:
  • Restricted from using certain app capabilities
  • Cannot list desktop apps in the Windows Store
  • Costs approximately $19 USD
  • Requires additional verification through Symantec
  • Costs approximately $99 USD
Both of these accounts will give the ability to publish to windows phone and store, and would need Credit card for verification.
Useful links:
Setting up payout account: In case you app is a paid one or you expect some revenue from in-app advertisements. Follow this link to setup this.

Publishing to store

I would say, publishing an app to windows phone store is not very difficult task, but at the same time for the first timers, it would look little daunting because of the following steps involved:

Technical certification requirements for Windows Phone

Ideally it is like a third party acting as QA and verifying your application against some predefined certification requirements. From my experience, I think they don’t focus a lot on testing your app features but the bottlenecks such as app reliability (should not crash), performance, app functionality, non-blocking ease of use, content validations like app text and icons are visible in light or dark background or in various themes like red, green etc, or whether app tile images or app listing details are fine.

So, it is strongly advised to test your app against the Windows App Certification Kit: The Windows SDK includes this kit. 
How to access in Visual Studio (Right click project and select "Open Store Test Kit":

Other preparations before publishing your app for certification:

Choose and reserve your app name: App name should be unique, so it is advisable to select few good names which doesn't exist in store.

Decide what age rating will apply to your app: It depends on the type of App.

Choose pricing: Free or paid. If paid then what would be the price.

Choose the countries and regions in which you want to sell your apps: All markets or some specific countries.

Write your app's description: The app description is kind of a summary of your published app’s capabilities. So a well-written description with to-the-point features details, can encourage your prospective users to download or buy your app.

Select Auto or Manual publish: In case of automatic publishing option, app will get published automatically once it passes certification. Once app passes certification, you will receive email confirmation. Even if “Auto” publish option is selected, it may take some time (few hours) before your app would be visible in the targeted store.

Submit App and then Track certification status: Once all details are filled correctly along with XAP file (build) and listing images, app can be submitted. In case after submission, you want to change something, you can cancel the submission and resubmit it again. Your every submission will go through certification process from start.

Microsoft's App submission/ tracking dashboard:

Tracking app submission

The certification process usually takes 5-7 days of time. If your app fails the certification, you will receive an email from Microsoft with detailed test report in PDF format. It will explain the expected and the actual result. These are generally standard tests outlined in their certification requirements. Correct these defects, and re-submit the new XAP file.

Some common blocks (tech or non-tech)

Network availability: Use following code to know network availability. You can add it as static property on App class to make it easy to access throughout the app.

public static bool IsNetworkAvailable
                return NetworkInterface.GetIsNetworkAvailable();

Image for dark and light theme: In case if you have an image for dark background, don’t worry, we can use same image for light background too. Use following code to achieve this:

Out of memory issues: These issues are mostly caught while testing app through a phone device. Use memory intensive controls like browser or others very consciously.

Few Advance Scenarios:

Creating Live Tiles: It is quite easy to add a live tile for you app. Check out this article -  Live Tile Templates in Windows Phone 8

Push notifications: There can be local or remote notifications. Remote would definitely need some services like Microsoft Push Notification Service (MPNS) which send data from cloud.
     Local notifications: These can be tiles, toasts, alarm, reminder notifications on the phone. Check out this link - Local notifications for Windows Phone  
     Remote notifications: Push notifications for Windows Phone 

Integrating Facebook with app: This is a nice article to get started on this - Integrate Facebook to Your Windows Phone Application 

Integrating Azure with phone: MobileService can be used to communicate to Azure data or other services. Check out this link: Get started with Mobile Services. Very soon, I am going to publish one article around this. Stay tuned.


In this article series - part-1: planning and environment setup, part-2: Development, and this part-3: Testing and Publishing, I have tried to cover most of the pain points for starting windows phone 8 developments. I believe it would be quite useful for beginners. I would recommend you to check out the source code from part-2 which contains a jump-start project design with many of the best practices discussed. Please get in touch with me if you have any questions or feedback @ manoj.kumar[at]

26 Jan 2014

Windows Phone 8 App Development Part-2: Developing an App

This article is the part-2 of the series of the article on windows phone 8 app developments -  Quick Start-up guide with best practices. This whole series is in 3 parts:
Part-1: Planning and Environment Setup
Part-2: App Development, best design practices, and some challenges 
Part-3: Testing/QA of the App and the process of publishing it to store
In case if you haven’t checked the part-1, I strongly recommend you to go through it first. 

Now I will discuss about the real app development challenges and some of the best practices to follow.

Language choice

This was one of the first confusion we had – whether to go with XAML/C# or HTML/JS
Although it depends on individual or team’s experience and liking, it seems that XAML/C# is clearly the most preferred choice for app development. I have listed down some of the reasons to choose one:-

XAML/C#: Windows Ecosystem, High Performance (Native), Resolution Independence, Easier UI Binding, Better Object Oriented Programming, Stateful (persistent state), Integration with Expression Blend, Easier debugging, better community knowledge support (coming from earlier Windows 7 days).

HTML5/JS: Multi-Platform, Lesser learning curve, JavaScript language flexibility, Easier styling thru CSS, Powerful query selection for elements, Better integration with Blend, Plugins. 

If you are new to XAML, then I would strongly recommend you to learn few basic concepts such as Xaml markups, Xaml Code behind, events, styles, behavior/triggers, binding (one time, one way, two-way etc)

App templates

There are many app templates available for win 8. 

If you really don’t care about template type, then let’s create a new Project for “Windows Phone Databound App” template.
If need more help, follow this link to create your first app: How to create your first app for Windows Phone

Design Considerations

The Windows phone application can be based on pure XAML or it can leverage the power of any MVVM framework. I always prefer to use MVVM framework with any XAML based application because of many advantages such as easy data binding or event handling, robust design with better SoC (Separation of Concerns), better testability etc.  
MVVM framework popular options: MVVMLight (Easy and very lightweight, good for Phone), Prism (More comprehensive and good for desktop or Windows store apps). 

The recently released free MVVMLight has support for Windows Phone 8. MVVMLight has following advantages:
- Very light weight (just around 50-60Kb in size)
- Inbuilt IoC (SimpleIoc)
- Decoupling of View Model by using publish/subscribe message based communication
- Relay Command: Less code behind.

In case you are new to MVVM pattern, please go through following link to understand it. It is used almost in every XAML app. Few concepts such as view models, data context, command, property change events etc are used extensively. 
Adding MVVMLight to the XAML project: Right click the project and select ‘Manage NuGet Packages’. Search ‘mvvmlight’ and install ‘MVVM Light’ (Toolkit). It will add few files and folders. If needs further help, follow these instructions: How to install MVVM Light Toolkit for Windows Phone

IoC implementation and importance

The SimpleIoc is really a great addition in GalaSoft MVVMLight. In most of the scenarios, view models are singleton objects and which can be easily managed by SimpleIoC and can be accessed anywhere in the application.
public class ViewModelLocator
        /// Initializes a new instance of the ViewModelLocator class.
        public ViewModelLocator()
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            if (ViewModelBase.IsInDesignModeStatic)
                // Create design time view services and models
                // Create run time view services and models


        public T GetInstance()
            return ServiceLocator.Current.GetInstance();
        public static void Cleanup()
            // TODO Clear the ViewModels

For easy access across application:

public static ViewModelLocator Locator
                if (_locator == null)
                    _locator = new ViewModelLocator();

                return _locator;
Async/Await pattern

Asynchrony proves especially valuable for applications that access the UI thread because all UI-related activity usually shares one thread. Application can stop responding. Async/await is a Tasked-Based Asynchronous Pattern (TAP) which is much easier to implement than Event-based Asynchronous Pattern (EAP) which came in .Net 2.0. We can create an asynchronous method almost as easily as you create a synchronous method. Read more here:  Asynchronous Programming with Async and Await
async private void LoadItems(string query)
            var items = await _data.GetItems(query);

            var itemVMs = items.Select(i => new ItemViewModel { ID = i.ID, LineOne = i.LineOne, LineThree = i.LineThree, LineTwo = i.LineTwo });
            this.Items = new ObservableCollection(itemVMs);

Windows Phone supports frame based navigation. The hardware back button makes navigation behave differently than desktop applications. Navigation can be based on “Data Template”, where depending upon current view model we can show view template registered with App resources. Data Template based navigation is quite common in WPF applications.
I suggest to use default frame based navigation. It is hassle free and provides automatic back navigation which is managed by the back stack. 
NavigationService available thru PhoneApplicationPage class (base class of every phone page).
// Navigate to the new page
NavigationService.Navigate(new Uri("/DetailsPage.xaml?selectedItem=" + (MainLongListSelector.SelectedItem as ItemViewModel).ID, UriKind.Relative));

In case you need to handle hardware back button press differently, then follow this:
At App level in App.xaml.cs:
private void RootFrame_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
            //Some custom logic/ condition
If (true)
e.Cancel = true;
 else {}

Or in page:
protected override void OnBackKeyPress(CancelEventArgs e)
    if(MessageBox.Show("Are you sure you want to exit?","Exit?", 
                            MessageBoxButton.OKCancel) != MessageBoxResult.OK)
        e.Cancel = true; 

Phone storage

User/App data can be stored in isolated phone storage. It would be good to add a utility class like AppSettings:
public class AppSettings
        IsolatedStorageSettings settings;
        bool isDirty;
        public AppSettings()
            //Get the settings for this application.
            settings = IsolatedStorageSettings.ApplicationSettings;

        /// Update a setting value for our application. If the setting does not
        /// exist, then add the setting.
        public void AddOrUpdateValue(string Key, Object value)
            if (settings.Contains(Key))
                settings[Key] = value;
            // Otherwise create the key.
                settings.Add(Key, value);
            isDirty = true;

        public bool ContainsKey(string key)
            return settings.Contains(key);

        /// Get the current value of the setting, or if it is not found, set the 
        /// setting to the default setting.
        public T GetValue(string Key)
            if (settings.Contains(Key))
                return (T)settings[Key];
            return default(T);

        /// Save the settings to isolated storage.
        public void Save()
            if (!isDirty)
            isDirty = false;

It can be added to App class as static field for easy access across application:
public static AppSettings Settings
                if (_settings == null)
                    _settings = new AppSettings();
                return _settings;
Windows Phone Toolkit

An important addition to the default App development ecosystem which has limited no of controls at our disposal. Toolkit has many useful components. To add this: Go to “Manage NuGet Package” and search “toolkit”. Install “Windows Phone Toolkit” from the available packages.
This toolkit has many new controls such as: AutoCompleteBox, ContextMenu, CustomMessageBox, DateTimeConverters, DateTimePickers, ExpanderView, ListPicker, LongListMultiSelector, Map extensions, RatingControl, ToggleSwitch, Navigation transitions.

Application Bar

It is an integral part of your app which enables easy navigation between pages. Add following lines of code with required menu items or icons in any page where you want to provide navigation options.

App bar:

Menu items can be hidden by setting "IsMenuEnabled " flag to false. The app bar can be in minimized state by setting “Mode” as “Minimized”.
Minimized app bar:

Phone page animated transition

It is quite easy to implement by adding following lines of code in page XAML. This is again possible because of toolkit. Even Effects such as SlideInEffect, TiltEffect and TurnstileFeatherEffect are possible thru use of toolkit.

For Page transition effect:


User Interface

The phone SDK provides some default theme and icons. It is highly recommended to use them as it matches the overall look and feel of phone. If needed new theme can be added or existing theme styles can be extended. It is good practice to keep these new styles in App XAML or a separate file. Expression blend can be used to efficiently create new styles.

SDK Path: C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0 
ICONs (Dark/Light): C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Icons
Adding custom styles at App level under:

Source Control

I used online visual studio as source control. It is just as easy to configure as we can do in our favorite TFS (Team Foundation Server). A valid Microsoft account is required to access online visual studio. License: The free version supports upto 5 users.
Link:  (Go to 'Visual Studio Online')

Source Code

I have developed a windows phone 8 solution which includes most of the best practices discussed above. It would be a great starting point for your application. 
Solution contains following:


In next post - part-3 of this article series, I will discuss about testing/QA of the developed application and the process of publishing it to windows store.

25 Jan 2014

Windows Phone 8 App Development Part-1: Environment Setup


With Windows 8, Microsoft has introduced major changes in the operating system and its user interface to improve overall user experience. Microsoft is positioning it as a next revolution in the technology of computer’s operating systems (OS) to compete with other tablet or mobile OS, including popular Android and iOS. Some of the key enhancements would be Speedy Boot Time, Live tiles based interface, Improved Search Function, Windows To Go (plug in, boot and go), or Windows Live Syncing. 

Read more about Windows 8: 
5 Reasons You Should Upgrade to Windows 8
5 Top Windows 8 Features You’ll Love

As there are significant changes in the platform, it is obvious that we need to unlearn some old ways and get used to all new windows 8 development environment. Although there are many changes in API, the best part is that we can still utilize the existing knowledge base - either we choose to develop in XAML/C# or HTML5/JS. 
Today I am going to discuss about the steps and challenges which any developer can face while starting windows phone 8 developments. These are the same experiences which I experienced when I started working on my first app.

I have divided this article Windows Phone 8 App Development - Quick Start-up guide with best practices in 3 parts:-
Part-1: Planning and Environment Setup
Part-2: App Development, best design practices, and some challenges 
Part-3: Testing/QA of the App and the process of publishing it to store


You are seasoned application developer with experience on Microsoft platform (C#, WPF/Silverlight, .Net, JavaScript).


Learn Windows 8 development ecosystem and in the process create and publish a real time application on Windows Phone 8 apps store for millions of potential users / customers in hundreds of markets around the world.


I am hoping that, since you have landed to this post and reading this article, you already have some application idea and you are looking for ways to jump-start the development. In case, you have not, the good news is that it's not late. We are in planning phase. This is the time when we should start visualizing our application. I am going to share my experience when we started and came to this stage.

Steps: (I worked with one more team member)

  1. Kick-off: We noted down all the points whichever came to our mind separately. We collated all the findings and finalized a priority list. This exercise was great as both of us came with very different requirements / blocks. It would be impossible to get in case of a discussion as our thought process would not have been so independent and could be obstructed by other’s point of view.
  2. Came up with some rough documentation.
  3. Planned the next steps. First and the biggest one were to setup the environment, and then dive deep into the world of windows 8 development.

Environment setup

Our minimum need was to have a Windows 8 OS VM with Visual Studio 2013 installed. So we started in following manner:
Note: Before downloading any software, please check with your IT department whether they already have.

OS (Operating System): Downloaded Windows 8.1 enterprise edition (90 day trial) from (64 -bit) [more than 2GB in size]
Visual Studio 2013: Ultimate with 90 days extended free trial. 30 days default, but which gets extended by 60 days on login with Microsoft Account through visual studio. [more than 2GB in size]. Link:

Virtual Machine Host: Need to have VMWare Workstation. I had Oracle Virtual Box, so I setup my Windows 8.1 OS VM using this client, but only to regret later when emulator installation failed during Visual Studio setup. We can’t imagine a developer life without emulator. Fortunately we came to know that emulator works fine with VMWare Workstation. So we downloaded VMWare Workstation 10 and recreated my Win 8 VM. VMWare Download Link:

Steps for creating VM: System Req: 64 bit system, 8 GB of RAM, 40GB Free Space, System should Support Hyper-V for Emulator to work.Follow steps defined in this article to create VM. It is very well explained.
Note: Follow the Hyper-V related changes carefully. It is mandatory for phone Emulator installation.

Once VM is created: Install Visual Studio 2013. It already has Windows Phone 8 SDK. Select all features while installation.


That’s it. In part-2 of this article I will discuss about the application development process and some of the initial challenges.