How to get GPS location from built-in surface pro GPS without internet connection

Anders F 0 Reputation points
2024-05-29T12:53:10.7766667+00:00

I need to be able to get the gps location from the built-in gps on a surface pro tablet. This is a WPF application and all my research says to use the GeoCoordinateWatcher class in System.Device.Location. This only seems to work when the tablet is connected to wifi and I did see on stack overflow that GeoCoordinateWatcher can't work without internet connection. Is this true that there's no way to get GeoCoordinateWatcher to work without internet connection, and if so, how would I go about getting the devices location using just the built-in gps without needing an internet connection?

Surface | Surface Pro | Network

Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sander van de Velde | MVP 36,941 Reputation points MVP Volunteer Moderator
    2024-05-29T16:29:27.4233333+00:00

    Hello @Andres F,

    welcome to this moderated Azure community forum.

    It seems it’s only the LTE/4g version that has the GPS. Are you sure your device has a GPS?

    If so, the GeoCoordinateWatcher is only available for .Net Framework 4.8.1 so you have a challenge when using .Net Core.

    As an alternative can you check if your GPS is available as a COM port within your Surface?

    In that case, check out the serial port library (eg. in .Net 8).

    GPS devices normally output a stream of ASCII messages in the NMEA format.

    Check out this blog post with some background information (like checking the NMEA message stream).

    From there, check out this NuGet package containing a parser for the most popular NMEA messages, based on this GitHub repo.

    This is a little side-step but it gives you more control over the GPS information, depending on the availability of the COM port support.

    Update: there is a port for .Net Core available as open source: https://github.com/dotMorten/System.Device Can you confirm this works for you?


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

  2. GeneWeimann 0 Reputation points
    2025-07-31T05:34:17.4966667+00:00

    Yes, it’s true that the GeoCoordinateWatcher class in WPF often relies on location services that may use Wi-Fi or network-based positioning, and it doesn’t consistently work with built-in GPS alone—especially without an internet connection. For scenarios like using a Surface Pro with only its GPS sensor and no internet, GeoCoordinateWatcher may not return accurate or any results. In such cases, a more direct approach is needed that communicates with the GPS hardware through serial ports or Windows Location API, which supports GPS sensors directly.

    For a car tracker company in Pakistan, this limitation means relying solely on WPF’s default libraries like System.Device.Location may not be reliable for offline or GPS-only environments. Instead, using native GPS data through NMEA streams or COM ports would give more control and precision, especially for real-time vehicle tracking where internet may not be available consistently.

    0 comments No comments