Learn how to write the code to use the GeoCoordinateWatcher available in the .NET Framework to ask Windows for the device location, which requires permissions, and provides latitude, longitude, and an estimate of the accuracy of the position provided.
- [Instructor] To obtain the location of our device,…we'll use the GeoCoordinateWatcher class.…Open Visual Studio, go to file, open project,…and where you extracted your exercise files,…go into the, Where am I, folder…and the Begin folder.…Open the CodeClinic solution…and let's add the code necessary.…First, notice in your Solution Explorer,…under the Where Am I project, we'll add a reference.…
Click add reference…and select framework…and then in the search dialog, type device.…You'll find the System.Device, DLL, show up,…click the checkbox and click OK.…So now we have an additional reference…in our project to the System.Device library.…We'll use that to reach the GeoCoordinateWatcher class.…So that completes the first step.…
Now let's use the GeoCoordinateWatcher.…Press control + dot,…get the using statement added,…using System.Device.Location…and now with this Watcher object…I can set it up to tell me, when the location changes.…So there are two things we are interested in,…Watcher.StatusChanged, because of permissions…
Skill Level Intermediate
1. Problem 1: Pond Oreille
2. Problem 2: Where Am I?
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Facial Recognition
6. Problem 6: Real-Time Information Dashboard
Next steps2m 46s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.