我想從可以將GeoPosition的CivicAddress中的Windows Phone 8.1獲取CivicAddress在Windows Phone 8.1
我用下面的代碼嘗試:
// Get Current Location
var geolocator = new Geolocator();
geolocator.DesiredAccuracyInMeters = 100;
var position = await geolocator.GetGeopositionAsync();
// Get Country
var country = position.CivicAddress.Country;
會拋出NullReferenceException異常的CivicAddress字段爲空。我知道Windows 8沒有提供CivicAddress提供程序。我想檢查Windows Phone 8.1是否屬於這種情況如果是這樣,我如何獲取/寫入CivicAddress提供程序?
THANK YOU!我搜索了一段時間的WinRT解決方案。這只是工作。 –
@ScottNimrod歡迎您。我很高興它有幫助。 – Romasz
這裏不需要創建新的BasicGeoposition myLocation,可以直接使用position.Coordinate.Point作爲參數來MapLocationFinder.FindLocationsAtAsync(); – vITs