我在Windows 8.1應用程序中工作,我正在使用下面提到的代碼找到用戶的當前位置。現在,當我使用Cellular網絡在平板電腦上運行我的應用程序時,該應用程序崩潰,但它在Wifi上正常工作。有人可以爲此提出解決方案嗎?在Windows應用商店應用(Windows 8.1)中使用GeoLocator時出現「管道正在關閉」錯誤?
geolocator = new Geolocator();
geolocator.DesiredAccuracy = PositionAccuracy.Default;
geolocator.DesiredAccuracyInMeters = 1000;
geolocator.MovementThreshold = 5;
geolocator.ReportInterval = 500;
try
{
Geoposition mygeoPosition = await geolocator.GetGeopositionAsync();
}
catch(UnauthorizedAccessException ex)
{
UserMessageUtil.ShowMessage("Location is disabled in Settings");
await Launcher.LaunchUriAsync(new Uri("ms-settings-location:"));
}
geolocator.PositionChanged += geolocator_PositionChanged;
我總是檢查在筆記本整機所以我沒有在過去面對這個問題,但現在我有一個平板電腦3G和WiFi連接,當我運行在平板電腦上的應用程序,並嘗試獲取當前位置,錯誤來了。
更新
我有時也得到組或資源不在正確的狀態來執行請求的操作。 (從HRESULT異常:0x8007139F)誤差線
Geoposition mygeoPosition = await geolocator.GetGeopositionAsync();
我得到這兩個錯誤,當我連接的蜂窩網絡
@rbrunditt我試着添加兩個參數,但仍然給我錯誤。是否有可能因爲我使用免費Bing Map鍵而導致問題? –
這與Bing地圖無關。 Geolocation API是與Bing地圖無關的核心Windows Phone庫。 – rbrundritt