GeoLocation no Windows Phone 8

Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracyInMeters = 50;
try   {
Geoposition geoposition = await geolocator.GetGeopositionAsync( maximumAge: TimeSpan.FromMinutes(5), timeout: TimeSpan.FromSeconds(10) );

LatitudeTextBlock.Text = geoposition.Coordinate.Latitude.ToString("0.000");
LongitudeTextBlock.Text = geoposition.Coordinate.Longitude.ToString("0.000");

}
catch (Exception ex) {
if ((uint)ex.HResult == 0x80004004)
   { // the application does not have the right capability or the location master     switch is off StatusTextBlock.Text = "location is disabled in phone settings."; }
//else
{ // something else happened acquring the location }



Mais em http://www.developer.com/ws/using-the-location-api-in-your-windows-phone-8-applications.html


Testar este também

        navigator.geolocation.getCurrentPosition(
          function(pos) {
            $("#lat_field").val(pos.coords.latitude);
            $("#long_field").val(pos.coords.longitude);
          }
        );

Nenhum comentário:

Postar um comentário