1

While using Xamarin.Mobile.Geolocator I've come across an odd bug that seems to be blocking me from resolving the Task. For example:

        var locator = new Geolocator ();
        if (locator.IsGeolocationAvailable) {
            Console.WriteLine ("Location Available");
            var task = locator.GetPositionAsync (10000);
            Console.WriteLine ("Task Created");
            var position = task.Result;
            Console.WriteLine ("Position Status: {0}", position.Timestamp);
            Console.WriteLine ("Position Latitude: {0}", position.Latitude);
            Console.WriteLine ("Position Longitude: {0}", position.Longitude);
        } else {
            Console.WriteLine ("newp");
        }

This function eventually times out on task.Result. I've attempted to debug this by setting the info.plist NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription params, changing it to .ContinueWith lambda, tested on simulator and actual device, set timeout to 100 seconds, but it always seems to crash on timeout.

Is this a problem with my implementation or a bug in Xamarin.Mobile? I would like to continue with Xamarin.Mobile, but I'm not opposed to reverting back to native implementation.

Thanks

Cameron
  • 86
  • 1
  • 2
  • 16
  • I have the same issue but for Android when using it indoors. Have you made any progress? For me iOS it's working ok. Do you use the latest version? http://stackoverflow.com/questions/28797525/getpositionasync-does-not-return-on-real-device-when-indoors-xamarin-android – Sunkas Mar 02 '15 at 08:45
  • hi @Sunkas, I actually did solve the problem. It may be different for you, but I had an issue with the .Result. I was able to fix by getting rid of .Result and running it inside a block after it's truly resolved. – Cameron Mar 16 '15 at 15:51
  • Ok. Could you answer your own question and paste the code you used to solve it? – Sunkas Jul 17 '15 at 07:13

0 Answers0