Jerry Nixon on Windows: WP7 Sample: A GPS-enabled Phone App in 5 minutes!

Wednesday, February 15, 2012

WP7 Sample: A GPS-enabled Phone App in 5 minutes!

One of the best parts of Windows Phone application development is how fast you can add sophisticated functionality to your solution.

In fact, I was teaching a weekend crash course on Windows Phone at Brigham Young University a few weeks back. Here’s a room of 100 smart, young developers following along with their laptops and Visual Studio. In a matter of hours (literally) – they had 5 sample Windows Phone applications running in their environments. Presto!

How many apps can other platforms build in a single day? Aw, snap! How many apps can other platforms build in 5 minutes? I am not kidding when I say Windows Phone development is rapid. Windows Phone developers are happy developers. Not only do they get to use Visual Studio (game changer), but the framework, Silverlight, and the OS provide them many of the tools other platforms make them jump hoops for.

In this article we will show how to use the GeoCoordinateWatcher. To be clear, I do not discuss how to use the native Bing Map control, but I do discuss it in detail in this article.

Let Build It!

Before we built it, I wanted to point out that using the GeoCoordinateWatcher means that you will be using the Location Services API in the Windows Phone. Whenever you use the Location Services API, you must also include in your application a Privacy Policy – without it, your application will not be certified for the Marketplace. I walk through how to create a Privacy Policy in this article.

Unable to display content. Adobe Flash is required.

in the video above, I build a simple GPS-enabled application. I demonstrate that you can put anything in the Content property of a Pushpin  including a button or anything (including items that are data bound). But I should also mention that you can re-skin the whole Pushpin by simply setting its Template property. This allows you to put custom items on the map.

Final note: In the sample the nag screen on the map appears. This will appear until you put in your developer credentials – get them from the Bing app center. Read more about implementing the map in this article.

Conclusion

In all reality, this map is cute but useless. These techniques and samples need you, the developer. They need not only your excellent development talent, but also your creativity and application ideas. Once you have the creative juices stirring, isn’t it nice to know that Windows Phone is stuffed with features, tools, and controls that can realize your dreams? I don’t want to overstate it, but it’s pretty awesome.

Best of luck!