10 Great Windows Phone 8 Code Samples (No, Wait… 30)

Sometimes we don’t want to read a blog posts on a topic, we want to look at the code implementing it. Working code cuts through the confusion and explanations and gets us to the heart of the things we want to do. That’s why we should be familiar with the wealth of samples available for Windows Phone on MSDN.

There are a lot of very cool samples on MSDN covering a lot of topics. As I went through them I was so inspired, I thought a visual of the samples would be a great way to help navigate them. So I selected 30 of my favorite sample and put together this chart showing how the samples walk through different Windows Phone 8 features and technologies.

image

(click for interactive version)

This isn’t to say there are only 30 good samples on MSDN. But I had to make a cut-off somewhere before I ended up with more information than I could reasonable show on a screen.

You can also download a larger static version of this graph here

I also wanted to highlight 10 of my favorite samples from that chart.

10) URI Association and NFC 

wp_ss_20130320_0007     wp_ss_20130320_0005

In Windows Phone 8 there are so many opportunities for our apps to connect outside of the sandbox. This sample looks at one of the ways we can launch our apps: URI Associations. We just register our app to handle the appropriate association and when the user hits a link with that association, it launches our app. Unless, of course, our app isn’t installed. If that’s the case, it goes to find out app.

This sample includes 3 projects so we can see all the options available with URI associations including simple app launching, selecting multiple apps from a list and NFC app launching.

9) LongListSelector PhotoHub

image     image

LongListSelector is a new control in Windows Phone 8 and the preferred control for showing big lists. But using it appropriately requires a little bit of practice and maybe a good sample or two. This sample shows how to use the LongListSelector with a large sorted group or photos. It includes an example of styling and templating with JumpListStyle, and GroupHeaderTemplate. Be sure to check out the companion sample LongListSelector PeopleHub.

8) LongListSelector Infininte Scrolling (With Twitter) 

wp_ss_20130320_0004

Another LongListSelector sample, but this really is an important concept in Windows Phone 8. What I love about this one is that it deals with a common scenario: Load a pile of data, let the user scroll and load more when they hit the bottom of the current list. In addition to that, it is a scrolling list with images, so we can see the preferred way to do background image loading for a really rich, smooth experience.

7) Visual Studio 3D Starter Kit

image

With Windows Phone 8, we support native code with an eye toward creating the most compelling gaming experiences on any mobile platform. This project is a great sampler of implemented features. Loading and rendering assets, animated meshes, 2D XAML HUD, shaders and some game logic make this a great intro to making games for Windows Phone8. As a bonus, it also can serve as a starting point for creating a Direct3D game with shared code between Windows Store (Windows 8) and Windows Phone 8 games.

6) Speech Recognition Using a Custom Grammar

wp_ss_20130321_00021     wp_ss_20130321_00031

Easy Speech recognition and synthesis APIs in Windows Phone 8 make speech one of my favorite new features. But the first question is always “Does speech recognition work when the phone is offline?” to which my answer is “Windows Phone speech is as functional offline as Siri is when on your phone is online." (Get it! It’s OK to laugh.) But that’s not actually very fair because Windows Phone speech is still pretty useful offline due to the ability to implement custom grammars that let the phone recognize a defined vocabulary of words.

This sample shows how to create a custom grammar and do speech recognition while suppressing the default speech recognition UI. It’s a powerful example.

5) Wallet membership and deals 

image     image

The Wallet APIs in Windows Phone are a really powerful way to connect your app to the user’s Wallet experience. This sample shows how to manage a custom membership card, connect it to the Wallet, and let the user select coupons to add to their Wallet. It’s a great demo for a feature that doesn’t get nearly the attention it deserves.

4) Windows Phone 8 Networking Samples

image     image

This is a wide ranging sample covering socket connections, NFC tag writing, NFC device-to-device connections, data downloads, and (most importantly) Bluetooth connections to the Lego Mindstorms NXTCar.

3) Chatterbox VoIP Sample App

image     wp_ss_20130321_0002

Under “little-known-features” a lot of people don’t know that Windows Phone 8 not only supports VoIP calls from your app using native APIs but offers to developers the use of default UI paradigms for making and receiving calls. Add to this the ability to run these calls in the background (just like any phone call) and it’s a powerful addition to our development toolbox. This sample goes through

2) Basic Lens App

wp_ss_20130321_0005     wp_ss_20130321_0004

Creating a Lens application means being part of an exclusive club of apps that do awesome things with the camera. By integrating our app with the default camera app through the Lens feature, our apps can become true extensions of the platform. This sample not only gives a complete implementation of Lens integration, but a complete implementation of a full-featured photo app. It has transition animations, UI for user focus, camera hardware button functionality, and PhotoHub integration. It’s a really powerful sample and a great place to start if you’re building a photo app for Windows Phone.

1) Photo Extensibility

wp_ss_20130321_0008     wp_ss_20130321_0009

Some of the samples have names that don’t really give a good idea of how awesome they are. Photo Extensibility is one of those samples. The truth is that extensibility is one of the most powerful developer features of Windows Phone 8 and this sample shows that power. It shows how to launch your pictures app from pretty much anywhere. Launch your app from the PhotoHub, using the share or edit or apps options on every photo, and how to add “captured by [your app name here]” rich media link on photos captured using your app. By implementing these extensions on your photo app you can make your app the center of they user’s mobile photo experience, which is a pretty exciting proposition.