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

XLabs Geolocation is slow

$
0
0

I am using the Geolocation service of XLabs. The code is as follows:

_cancelSource = new CancellationTokenSource();
            await
                _geolocator.GetPositionAsync(10000, _cancelSource.Token, true)
                    .ContinueWith(t =>
                    {
                        if (t.IsFaulted)
                        {
                           // PositionStatus = ((GeolocationException)t.Exception.InnerException).Error.ToString();
                        }
                        else if (t.IsCanceled)
                        {
                           // PositionStatus = "Canceled";
                        }
                        else
                        {
                            string PositionStatus = t.Result.Timestamp.ToString("G");
                            string PositionLatitude = "La: " + t.Result.Latitude.ToString("N4");
                            string PositionLongitude = "Lo: " + t.Result.Longitude.ToString("N4");
                        }
                    }, _scheduler);

This works fine but is really slow. It takes about 8 seconds to reach the else part with the Result.

Is this normal or am I doing something wrong?
I as well made an example with Xamarin.Mobile which is much quicker.

EDIT:
The platform I'm using is Android.


Viewing all articles
Browse latest Browse all 79144

Trending Articles