Problem with GeoLocator Plugin


Just started using Xamarin and got an issue with the GeoLocator Plugin
I'm using Xamarin 4.7.10 with Xamarin Android in VS.Net 2015 U3, using a AVD Nexus 4 Android 7.1.1 Intel Atom x86.

Created my first project, added a button and added the clicked event

    private async void Button_Clicked(object sender, EventArgs e)
            await Static_Functions.AddGPSTrackingRecord();

The function that handles the GPS part :

    internal async static Task AddGPSTrackingRecord()
            var locator = CrossGeolocator.Current;
            if (locator.IsGeolocationAvailable && locator.IsGeolocationEnabled)
                var location = await locator.GetPositionAsync(new TimeSpan(5000));

                if (location != null)
                    GPSTracking newTrackingRecord = new GPSTracking();
                    newTrackingRecord.Latitude = location.Latitude;
                    newTrackingRecord.Longitude = location.Longitude;

Unfortunately the app crashes in the await.locator statement.
No call stack, only a 'An unhandled exception occured.', breaking shows no code because all threads were executing external code.

Any Idea's on what should have gone wrong, seems to me to be something straightforward, no?

Sven Peeters


  • prashantvcprashantvc USXamarin Team Xamurai

    Hi @speeters,

    It looks like a native crash, could you share the ADB log from the emulator? It will help us to troubleshoot the issue.

  • speetersspeeters BEMember ✭✭

    Hi prashantvc,

    I downloaded the latest version of Xamarin and now my code is working.
    So might have been an issue in the framework somewhere.

    Sven Peeters

Sign In or Register to comment.