Geolocation Always Returns same coordinates

Hi folks

ive been having a real head scratcher for days that i can't get to the bottom of. when i use the snippet of code below on All emulators, my own motorola G7 power (android 9.0), my kindle HD 8 (OS ver, & my windows 10 PC (latest fast ring insider preview version), it all works perfect, (better than id hoped), however a mate who is testing for me has an LG M200 running android 7.0 & it always returns the same lat/long co-ordinates no matter where he is or how many times he geolocates. it doesnt bomb with an exception or anything.

if he views the google map (in my app) and presses the 'bullseye' it automatically moves to his current location as expected, the map scrolls when he drags it, and all works fine, so it appears the problem is to do with whats being returned from the xamarin essentials GetLocationAsync call. btw the map isnt loaded when we make the call.

  • location services are on for the app and phone
  • settings > location > mode > high accuracy is set
  • ive tried both james monte's plugin and now use the essentials version
  • the google essentials 'home address' is set to his own address (not the constantly returned lat/long)
  • it always reports the same accuracy of 10074
  • initially when i first tried the essentials version without a timeout, it waited forever (as reported on several threads) but since the timeout was added it gets the location within 5 seconds, but of course its the same location as it always was, no matter what i try !!.

what's quite wierd is that the returned address is one we both know very well, it's outside a bar we use every week, however i only installed my app on his phone a few days ago, 4 days since our last visit there but there doesnt appear to be any address or anything that i can find plumbed into his phone that relates to either the address or co-ordinates that are being returned, and as he's a non-techie and never used anything geolocating before (apart from possibly playing around in the past) im totally stumped where to look next.

the nearest ive had to this before in the past was when i took my kindle out to an area with no wifi to see what would happen, it recorded an address (my own i think it was) with something like a 21k accuracy.

im off away for a few days and will try to have a look on here in case anyone is kind enough to reply, so if anyone has any ideas on what could be causing this and how to cure it, id be really grateful.

many thanks


ps: the (GeolocationAccuracy)DeviceSettings.DesiredGPSAccuracy bit is where i get the accuracy required from my app settings, where i add the various options from the Enum into a dropdown box, ive tried them all but stick on 'Medium' (3) for the most part.

here's the key code in my viewmodel that i plagiarised from James's article when reading about swapping from the plugin to essentials, (should be familiar lol), and i know i really shouldnt use the UI DisplayAlert like this, but im trying to find if any exception was thrown (which it isnt)

if (!getLocation)

           var request = new GeolocationRequest((GeolocationAccuracy)DeviceSettings.DesiredGPSAccuracy, new TimeSpan(0, 0, 5));
           location = await Geolocation.GetLocationAsync(request);

           if (location != null)
              // FLOW ALWAYS COMES HERE
              Debug.WriteLine($"Latitude: {location.Latitude}, Longitude: {location.Longitude}, Altitude: {location.Altitude}");
              return location;
        catch (FeatureNotSupportedException fnsEx)                                  // Handle not supported on device exception
           errMsg = "FeatureNotSupportedException: " + fnsEx.Message.ToString();
        catch (FeatureNotEnabledException fneEx)                                    // Handle not enabled on device exception
           errMsg = "FeatureNotEnabledException: " + fneEx.Message.ToString();
        catch (PermissionException pEx)                                             // Handle permission exception
           errMsg = "PermissionException: " + pEx.Message.ToString();
        catch (Exception ex)                                                        // Unable to get location
           errMsg = "Exception: " + ex.Message.ToString();
     while (false);

     if (errMsg != null)
        await App.Current.MainPage.DisplayAlert("GEOLOCATION ERROR", errMsg, "Ok");

     return new Location();                                                                        


  • MyClockMyClock Member ✭✭

    I cant believe im the only one thats seen this issue, and no-one has any suggestions, and now another tester has reported the same issue on windows 10, when i see neither problem on my own test devices. could it be something in the device settings they have switched off?, but i cant find anything, not even a hint of an idea from the xamarin support team - are you here to help or what, at least please try

Sign In or Register to comment.