Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147856 | Sep 25,2019 09:43 PM UTC | Sep 26,2019 11:12 AM UTC | Xamarin.Forms | 1 |
![]() |
Tags: SfMaps |
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"); } } |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.