Back to results for “Geolocation”
.NET MAUI › Maps & Location

How do you continuously track and display the user's location on a map?

Advanced

Answer

Combine Geolocation.Default.GetLocationAsync in a loop or platform continuous-location updates (via a listener) with map recentering. Update a pin/position on the main thread, throttle updates to save battery, and stop tracking when the screen is not visible. For background tracking, use platform location services.
// Poll periodically while the page is active
var loc = await Geolocation.Default.GetLocationAsync(
    new GeolocationRequest(GeolocationAccuracy.Best));
map.MoveToRegion(MapSpan.FromCenterAndRadius(
    new Location(loc.Latitude, loc.Longitude), Distance.FromMeters(200)));
Real-world example A running app follows the user's position live, recentering the map as they move while throttling updates to conserve battery.

Common follow-ups: How do you save battery while tracking? | What handles background location?