Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Map, how get current location

$
0
0

Hi,first than nothing, I dont speak English very much, so sorry for that.

I'm new in Xamarin, and I'm trying create a Project Xamarin Form and I'm having problems with the Map in my project. I have a component Map but I would like when my app start, the map be in the current position of device. I have severals days but nothing. I tryed this:

private async Task Button_ClickedAsync(object sender, EventArgs e){
    var locator = CrossGeolocator.Current;
    locator.DesiredAccuracy = 50;

    var location = await locator.GetPositionAsync(TimeSpan.FromTicks(10000));
    Position position = new Position(location.Latitude, location.Longitude);

    MyMap.MoveToRegion(MapSpan.FromCenterAndRadius(position, Distance.FromMiles(3)));

}

Please help me :(


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>