2

I am developing both and iOS and Android version that requires GPS using Xamarin.

On iOS it's working fine, however now developing the Android version I have some issues with the GPS. It does not fetch the GPS but times out. However, on a emulator (using Genymotion) it fetches a coordinate right away. Note that I am using the Xamarin.Mobile (latest plugin 0.7.5).

    private async Task<HelpPosition> CreateGeolocator ()
    {
        int accuracy = SettingsManager.Instance.GetSettings ().Accuracy;
        Geolocator locator = new Geolocator (this) { DesiredAccuracy = accuracy * 10 };

        Position p = await locator.GetPositionAsync (timeout: 10000);

        return new HelpPosition{ Latitude = p.Latitude, Longitude = p.Longitude };
    }

This always code times out after 10s. I have set the ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions.

The issue seems only to occur when indoors. However Google Maps is perfectly fine getting my exact position. And I have checked all settings in Location Services (Use wireless networks and Use GPS satelites). The device is a Samsung Note 2.

Sunkas
  • 9,542
  • 6
  • 62
  • 102

1 Answers1

0

Never got Xamarin.Mobile working to satisfaction on Android indoors so I tested the only other option in Component Store avaliable: Geolocator. Works like a charm!

https://components.xamarin.com/view/GeolocatorPlugin

Edit It works better, but even with this plugin I get reports that the location received is off. The search for a better solution continues...

Sunkas
  • 9,542
  • 6
  • 62
  • 102