2013-01-11 27 views
0

我正在開發一個基於位置的社交網絡應用,並正在使用的高精度的geocoordinatewatcher和20M的移動門限,獲取用戶的位置。我的問題是關於定位的頻率。從文檔,我推測,20米運動門檻只是意味着,如果當前位置爲20m距離的位置遠在前面的位置改變事件不會被觸發的位置改變事件。這表明,位置修正還是發生了,但他們沒有,如果<20米觸發事件處理程序。設備如何決定執行定位的頻率?改變運動閾值是否會以任何方式改變這一點?任何額外的文件,我可能錯過了,歡迎!Windows Phone的定位API

謝謝!

回答

0

對我來說,這聽起來就像如果當前位置>從上一個位置20米觸發事件..

如果有改變閾值的方式,這似乎會觸發不同,但最大分辨率可20米因爲這通常是如果我記得是正確的,那麼衛星有什麼最大限度的不確定。

+0

我假設,以確定是否當前位置>20米設備必須觸發位置鎖定。我試圖瞭解什麼決定了發生這種事情的頻率。 – bml

+0

在我看來,定位發生在狀態發生改變時發生。對我來說,這聽起來像是「定位」發生了,意味着當前位置距離之前的位置已經> 20米。 –

+0

這是網站http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.statuschanged.aspx –

1

我覺得你是想了解MovementThreshold如何工作,以及如何設置的。

基本上你可以說:

public class MyClass 
{ 
     private IGeoPositionWatcher<GeoCoordinate> _geoCoordinateWatcher; 

     /// <summary> 
     /// Gets the geo coordinate watcher. 
     /// </summary> 
     private IGeoPositionWatcher<GeoCoordinate> GeoCoordinateWatcher 
     { 
      get 
      { 
       if (_geoCoordinateWatcher == null) 
       { 
        _geoCoordinateWatcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High); 
        ((GeoCoordinateWatcher)_geoCoordinateWatcher).MovementThreshold = 3; 
       } 
       return _geoCoordinateWatcher; 
      } 
     } 
} 

別的地方,你可能有

DispatcherTimer currentSpeedTimer = new DispatcherTimer(); 
      currentSpeedTimer.Interval = new TimeSpan(0, 0, 1); 
      currentSpeedTimer.Tick += (sender, e) => 
      { 
       if (this.GeoCoordinateWatcher.Position.Location.HorizontalAccuracy < 10) 
       { 
        if (DateTime.Now - this.GeoCoordinateWatcher.Position.Timestamp.DateTime > new TimeSpan(0, 0, 2)) 
        { 
         CurrentSpeed = 0; 
        } 
        else 
        { 
         CurrentSpeed = double.IsNaN(this.GeoCoordinateWatcher.Position.Location.Speed) ? 0 : this.GeoCoordinateWatcher.Position.Location.Speed; 
        } 
       } 
      }; 
      currentSpeedTimer.Start(); 

這也是值得指出的是,我發現使用.NET無擴展和IGeoPositionWatcher工作合作的很好的我。

http://msdn.microsoft.com/en-us/data/gg577609.aspx