UWP-059 - UWP Weather - Accessing the GPS Location

Play UWP-059 - UWP Weather - Accessing the GPS Location
Sign in to queue

Description

Now that we can call the web service and get data, this third video demonstrates how to access the current location of the user's device using the Location capabilities of Windows 10.

Lesson source code: https://github.com/Windows-Readiness/AbsoluteBeginnersWin10/tree/master/UWP-059/UWP-059

Full series source code: https://github.com/Windows-Readiness/AbsoluteBeginnersWin10

PDF: Coming Soon

Embed

Download

Download this episode

Download captions

The Discussion

  • User profile image
    Brent Goodman

    When running this, I was getting exception errors in the "LocationManager.cs" file when it was called. To resolve the issue, I had to open the file "Package.appxmanifest", and then from the "Capabilities" tab, select the "Location" checkbox. Once I ran the application again, this time I was presented with the dialog box asking to allow the application to access my location. No further errors.

  • User profile image
    ToyMaker

    Also worth noting: Geolocation access status always results to "Denied" if the user has disabled location in windows 10 (settings --> privacy --> location), and there seems no way to circumvent it. The user will never see the app's prompt to allow location.

  • User profile image
    IamThePeter

    For me, where i am located, the JSON returned this for the wind:

    "wind":{"speed":6.87,"deg":294.501}

    Since the Wind class had "deg" as an integer, it would fail. I had to change the class to accept a double for deg.

     

  • User profile image
    Ivan

    How can I use an external USB/Bluetooth GPS?

  • User profile image
    kittananj

    From the line of get latitude and longitude are "position.Coordinate.Point.Position.Latitude" and "Position.Coordinate.Point.Position.Longitude", accordingly.

    I tried it, and it works.

Add Your 2 Cents