Mobile API GPS Sample Code

I am looking for some sample code to get the Geolocation service working. I am using the code below:
When the code gets to t.Result.Timestamp, the variable t is not null, but has no values for Latitude or Longitude. Does anyone have some sample code or project I can use to get started?

//get the location
var locator =  new Xamarin.Geolocation.Geolocator (this) { DesiredAccuracy = 50 };
if (!locator.IsListening)
{
    if (!locator.IsGeolocationAvailable || !locator.IsGeolocationEnabled)
    {
        Log.Debug("App","Location not available");
    }
}

locator.GetPositionAsync (timeout: 10000).ContinueWith (t => {
    try {
        Log.Debug("App","Position Status: " + t.Result.Timestamp);
        Log.Debug("App","Position Latitude: " + t.Result.Latitude);
        Log.Debug("App","Position Longitude: " + t.Result.Longitude);
    }
    catch (Exception ex)
    {
        Log.Debug("App",ex.Message);
    }
Sign In or Register to comment.