I am developing an app to track users live location.I have the updated positions from geolocator plugin.when i get new positions i change the pin position.But it is not changing in the map.Here is the code,
this method is called in every 1 sec
private async void TrackMe()
{
var current = await CrossGeolocator.Current.GetPositionAsync();
current.Accuracy = 30;
float bearing =float .Parse ( current.Heading.ToString ());
var pins = new Pin { Label = "ME", Icon = BitmapDescriptorFactory.FromBundle("path4646.png"), Flat = true };
var latitude = current.Latitude;
var longitude = current.Longitude;
Device.BeginInvokeOnMainThread(() =>
{
pins.Position = new Position(latitude, longitude);
pins.Rotation = bearing;
if (MapTrack.Pins.Count == 0)
{
MapTrack.Pins.Add(pins);
}
MapTrack.MoveCamera(CameraUpdateFactory.NewPosition(new Position(latitude, longitude)));
});
}
Any help will appreciated, thanks in advance
Regards