Get location in Windows 10 Universal App
The new Windows 10 documentation says that you must use Geolocator.RequestAccessAsync () before getting the user's location. However, this method doesn't seem to be available. The only parameters I can use are "Geolocator.Equals" and "Geolocator.ReferenceEqual".
When I try to get the location without using RequestAccessAsync. I get a message that "the pipe is closing". I have included the code I am trying to use to get the location below.
Geolocator geolocator1 = new Geolocator { DesiredAccuracyInMeters = 250 };
Geoposition pos = await geolocator1.GetGeopositionAsync();
source to share
Do you have the right type of project? Geolocator Windows 8.1 apps do not have this method, but it does have other methods and properties that you call in the code snippet.
Windows.Devices.Geolocation.Geolocator.RequestAccessAsync () needs to be available for Universal Windows apps and appears to me in a Windows Universal project in Visual Studio 2015RC.
This is a static function, so you don't need an object instance:
await Windows.Devices.Geolocation.Geolocator.RequestAccessAsync();
source to share
You may also need to check if the following is set under Package.appxmanifest:
<DeviceCapability Name="location" />
You can check my own Location Example if that helps too
source to share