I’m trying to make an application in Windows 8 that can locate the user’s location. for this I have the following class
public sealed partial class Cercano : CentrosCo.Common.LayoutAwarePage
{
Geolocator geo = null;
public Cercano()
{
this.InitializeComponent();
}
public async void button1_Click(
object sender, RoutedEventArgs e)
{
if (geo == null)
{
geo = new Geolocator();
}
IGeoposition pos = await geo.GetGeopositionAsync();
textLatitude.Text = "Latitude: " + pos.Coordinate.Latitude.ToString();
textLongitude.Text = "Longitude: " + pos.Coordinate.Longitude.ToString();
textAccuracy.Text = "Accuracy: " + pos.Coordinate.Accuracy.ToString();
}
In IGeoposition get the error:
Windows.Devices.Geolocation.IGeoposition is inaccesible due to its potection level,
Select location already in the manifesto …
The async return type of the Geolocator.GetGeopositionAsync() Method is Geoposition, not IGeoposition.
Try this: