Followers

Tuesday 27 September 2016

Xamarin form Geolocation task cancelled exception

Source: stackoverflow.com --- Monday, September 26, 2016
I am working on Xamarin form app with andorid, UWP and Windows 8 project. I am using Geolocation plugin created by Jamesmontemagno to get the current device location. It is working fine in Windows 8 and UWP but whenever I am trying to run it against the android device I keep getting task cancelled exception. I have checked all the permissions that are required as per suggestion but still no luck. My code to access location is below protected override void OnAppearing() { var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 100; //100 is new default if (locator.IsGeolocationAvailable && locator.IsGeolocationEnabled) { try { var position = locator.GetPositionAsync(timeoutMilliseconds: 60000).Result; //var pp = helper.Setting.Location; var Latitude = position.Latitude; var Longitude = position.Longitude; } catch(Exception ex) { var exc = ex; } } } Below is an image for my settings for android manifest ...



from Windows http://ift.tt/2d3y6Q8

No comments:

Post a Comment