A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hello @Bhuwan ,
Thanks for your question.
You can refer to these following steps:
- Get the bus's location by using
Microsoft.Maui.Essentials→ the Geolocation API to read GPS coordinates on a timer (for example, every 3–5 seconds). For tracking while the app is minimized, you may also need a foreground service on Android and background location mode on iOS, since MAUI does not provide this out of the box. - Send the location to a server
On the driver side, use HubConnection.InvokeAsync("SendLocation", latitude, longitude) to push updates to your ASP.NET Core SignalR Hub. The hub then broadcasts the coordinates to all parents watching that bus using Clients.Group(busId).SendAsync("ReceiveLocation", ...).
For addition information, you can refer to ASP.NET Core SignalR .NET Client.
- Receive updates on the parent app by using
connection.On<double, double>("ReceiveLocation", ...)to listen. When a new coordinate arrives, update the busPinposition on theMapcontrol. To avoid the pin "jumping," you can animate between the old and new coordinates over a short interval. - Show the route
Microsoft.Maui.Controls.Maps supports Pins and Polylines, but it does not calculate driving routes. For an actual road path, you would need to call a routing service such as Google Directions API or Azure Maps Route API, then draw the returned points as a Polyline.
I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback. Thank you.