The Windows Phone mobile client operating system has been around since 2010. The first release was Windows Phone 7 in October of that year. At the initial launch, there were 10 devices from HTC, Samsung, and LG that came loaded with the operating system. The OS was updated to Windows 7.5 (Mango) in May 2011, and now Microsoft has debuted Windows Phone 8. It was released along with new releases of most of Microsoft’s product line. Windows Phone 8 has started to gain some attention since its release. With partners, like Nokia releasing a flagship phone, it has gained a big following and become a realistic competitor to iOS and Android. With the popularity of Windows Phone 8, it is a great time for developers to start building their own applications for the platform. Here’s a guide to build your application:
1. Set Up Your Environment
The first thing you need to do in order to develop an application for Windows Phone 8 is to download and install the Windows Phone SDK. You can download the SDK here: http://dev.windowsphone.com. In order to install the SDK, you must run Windows 8. Once you install the SDK you are ready to go.
2. Tool Used To Build Your Application
The tool you will use to build your application is Visual Studio. When you install the Windows Phone SDK, it will install a light version called Visual Studio Express 2012 for Windows Phone and the Windows Phone 8 Emulator. If you already have a full version of Visual Studio, Visual Studio Express 2012 for Windows Phone works as an add-in. It has just enough functionality for you to build your first application and get familiar with the process. However, it will expire after 30 days. At that time, you will need to register in order to obtain a free product key for ongoing use. Don’t worry, the application you develop in the Express version can be used in the full version as well.
Also, make sure you check the system requirements for Windows Phone SDK 8.0 and Windows Phone 8 Emulator before installation. The SDK will install and run successfully if your system meets the hardware and operating system requirements, but does not have all of the requirements for the emulator. If you do not have all of the requirements for the emulator, you will not be able to deploy or test your applications.
Visual Studio has a built-in emulator to help you test your application. There are four different screen sizes (WVGA 512MB, WVGA, WXGA, and 720P) you will have to test before your application can be placed on the Windows Store. These four screens sizes cover every device that runs Windows Phone 8. The emulator allows you to test on each one by specifying the screen you want to test on when you debug your code. The built-in emulator makes it very easy to test.
3. Build your Application
Now that you know about the tool, it’s time to build your application. First, open Visual Studio and go to File->New->Project. Select “Windows Phone” from the templates. Then, select “Windows Phone Application.” This will set up all the necessary files for you to get started. Check out Microsoft’s Dev Center for instructions on how to build a simple first application. This is a simple browser application that takes in a Web address from a user and directs them to that address.
Applications for Windows Phone 8 are written in XAML, which is a declarative markup language. XAML is used in Silverlight and Microsoft Presentation Foundation (WPF), and has become the markup language for both Windows Phone 8 and Windows 8. Check out the links below to learn how to get started with XAML.
There are two issues I came across while creating my first application that are worth noting. The first issue deals with updating the screen after the initial load. Windows Phone will not allow you to update the main screen while in a non-UI function. This is a feature to keep users waiting on screens to load. They do not want you to interfere with the user experience; therefore, a dispatcher must be used in order to update the screen asynchronously. This brings me to the second issue. All APIs are called asynchronously in Windows 8 and Windows Phone 8. This may not be new to you, but for someone just starting out, it is worth mentioning. I was used to making API calls synchronously, so the asynchronous call was something I had no prior experience.
Asynchronous and synchronous calls are performed as soon as you make the call in your code. The difference between them is what happens after you make the call. Synchronous calls wait until a response is received before the program can continue on with the next line of code. Asynchronous calls allow the program to continue running while waiting for a response. When the Asynchronous call receives a response, it will branch and process the response. Microsoft decided to only allow asynchronous calls so they won’t interfere with user experience and let the application run other processes while waiting for a response.
Drive digital transformation with enterprise web and mobile applications through Microsoft Solutions
4. Test your Application
After you build your application, compile your code and use Visual Studio’s emulator to test on all four screen sizes. Visual Studio will allow you to debug your code while you test your application in the emulator. You can use the emulator just like you would your phone – drag the screen up and down, access applications in the application drawer, and add applications and widgets to the home screen. Then, open the application you created and run it through the paces to ensure you can’t break it.
5. Next Step
After you ensure your application compiles and runs on all four screen sizes, it’s time to submit it to the Windows Store. To find out more about the Windows Store, check out last week’s blog entitled, “How to Take Your Windows Phone 8 Application to Market” or visit the links below for more information.
If you have Windows Phone 8 Application questions and/or looking for more great tips, please send us a tweet @CrederaMSFT.