Mobile Zone is brought to you in partnership with:

Jerry Nixon is the Microsoft Developer Evangelist in Colorado. He has scary knowledge about Architecture, XAML, and SQL Server. He has terrifying knowledge about Windows Phone, the Kinect, and C#. And, he has simply ridiculous knowledge on Windows Desktop development in Windows 8. Jerry is a DZone MVB and is not an employee of DZone and has posted 105 posts at DZone. You can read more from them at their website. View Full User Profile

Windows Phone: A GPS-enabled Phone App in 5 minutes!

02.21.2012
| 4534 views |
  • submit to reddit
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.

In this video, 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!


Source: http://blog.jerrynixon.com/2012/02/wp7-sample-gps-enabled-phone-app-in-5.html

Published at DZone with permission of Jerry Nixon, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Paul Shezier replied on Fri, 2012/04/13 - 2:55pm

Great video. However; I've found that when I implemented the GeoCoordinateWatcher for my own application I noticed that the Speed property on GeoCoordinate always returns 0 when running in the emulator which made my application difficult to debug. Better yet, once on the device once you moved (got OnPositionChanged to fire) and then became completely stopped (again after moving) the GeoLocationWatcher fails to publish the OnPositionChanged event. Which might fail to update the UI with the current speed of zero.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.