How to get Device Location in .NET 8 WPF App without Internet

Sashikanta 0 Reputation points
2025-07-11T08:26:04.7333333+00:00

Hi Community ,
Is it possible to obtain the device's location coordinates in a .NET 8 WPF application without requiring an internet connection? The goal is to access the location without relying on WINRT, as this only supports up to .NET 5. What alternative solutions can be utilized in .NET 8 for this purpose?

Developer technologies | Windows Presentation Foundation
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. jhonnmick 0 Reputation points
    2025-07-11T15:56:43.2366667+00:00

    Yes, it's possible to get the device's location in a .NET 8 WPF app without internet and without using WinRT. The best approach is to use an external GPS device (like a USB or Bluetooth GPS module) that sends location data over a serial port. You can read this data using the System.IO.Ports.SerialPort class and parse the NMEA strings it provides to get the latitude and longitude. It's a practical offline solution that works well without relying on older APIs.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.