We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

retrieve current location programatically

Thread ID:





147856 Sep 25,2019 09:43 PM UTC Mar 3,2021 08:01 AM UTC Xamarin.Forms 3
Tags: SfMaps
Asked On September 25, 2019 09:43 PM UTC

I'm using the sfMap and I need to find usre current location and allow to zoom on the map.
Is there any way to retrieve location (programatically ) on SfMaps?


Bharathiraja K [Syncfusion]
Replied On September 26, 2019 11:12 AM UTC

Hi Maryam, 
Greetings from Syncfusion. To find out the Current Geo location, we have to refer Xamarin.Essential package. After getting GeoCoordinate  location, we need to update this value to map markers to pin on the Maps. Please refer the below code snippet to get the GeoCoordinate points of current location. 
private async void AddMarkerInCurrentLocation()
                // 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();
            catch (Exception ex)
                // Handle not supported on device exception
                await Application.Current.MainPage.DisplayAlert("Alert", ex.Message, "Ok");
Please refer the below help document for adding Markers on Map.  
We have prepared a sample based on your requirement and it can be downloaded from the below link. 

Replied On March 2, 2021 08:35 AM UTC


Is this sample code/project still available? I am getting an error on the link.

Many thanks,


Sridevi Sivakumar [Syncfusion]
Replied On March 3, 2021 08:01 AM UTC

Hi Yemoku,

We would like to inform you that the below KB document will assist you to show the current GPS location in SfMaps.


Let us know if you need any further assistance.

Sridevi S.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon