Maximize productivity with
30% off* for a limited time
using BOOSTDEV30.
Includes 3- and 5-packs.
*Some exclusions may apply.New Product LaunchBoldDesk: Help desk ticketing software starts at $10 for 3 agents.
Try it for free.
private async void AddMarkerInCurrentLocation()
{ try { // To get the current location var location = await Geolocation.GetLastKnownLocationAsync(); // Add the marker on the current location if (location != null) { CustomMarker marker = new CustomMarker(); marker.Latitude = location.Latitude.ToString(); marker.Longitude = location.Longitude.ToString(); layer.Markers.Add(marker); } } catch (Exception ex) { // Handle not supported on device exception await Application.Current.MainPage.DisplayAlert("Alert", ex.Message, "Ok"); } } |