private GetGeopositionAsync ( ) : IAsyncOperation |
||
return | IAsyncOperation |
Geolocator geolocator = new Geolocator(); Geoposition position = await geolocator.GetGeopositionAsync(); double latitude = position.Coordinate.Latitude; double longitude = position.Coordinate.Longitude;
Geolocator geolocator = new Geolocator(); geolocator.DesiredAccuracyInMeters = 10; // set accuracy level to 10 meters Geoposition position = await geolocator.GetGeopositionAsync(); double latitude = position.Coordinate.Latitude; double longitude = position.Coordinate.Longitude;In conclusion, the package library used in the above code examples is Windows.Devices.Geolocation, and the Geolocator class is used to determine the device's location.