The sample demonstrates the basics of using the Location API. This sample shows you how to:
-
Obtain a single-shot location. You should use this to conserve power if your app does not need to track location.
-
Track location continuously.
-
Track location continuously while running in the background.
-
Allow the user to opt in and out of using the location-based features of your app.
For more info on writing Location-aware apps for Windows Phone, see Location for Windows Phone 8.
Build the sample
-
Start Visual Studio Express 2012 for Windows Phone and select File > Open > Project/Solution.
-
Go to the directory in which you unzipped the sample. Double-click the Visual Studio Express 2012 for Windows Phone solution (.sln) file.
-
Use Build > Rebuild Solution to build the sample.
Run the sample
-
To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.
-
If you are running the app on the Windows Phone 8 Emulator, you can simulate location data by clicking on the Additional Tools button (>>) in the emulator tool bar and then click on the Location tab. Then click on the map to simulate a location reading.
See also