ユーザーの場所を特定できる Windows 8 のアプリケーションを作成しようとしています。このために、次のクラスがあります
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();
}
IGeoposition で次のエラーが表示されます。
Windows.Devices.Geolocation.IGeoposition は、その保護レベルのためにアクセスできません。
マニフェストに既にある場所を選択してください ...