我有下面的代碼,每0.5個氣泡就會觸發GeoCoordinateWatcher PositionChanged事件。它可能會更少。但那就是我的要求。windows phone中的GeoCoordinateWatcher在給定的時間間隔內不觸發事件
問題是當我用手機行走時,代碼每隔0.5米就不會觸發事件,而是隨機在0.5米後觸發事件。有時當我快速移動時,它會立即觸發幾個事件。
任何人都可以幫助我確保它準確地每0.5米觸發positionchanged事件。
watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
if (watcher.Permission == GeoPositionPermission.Granted)
{
watcher.MovementThreshold = 0.5;//in meters
}
watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged); // PositionChanged events occur whenever your position changes
watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_OnStatusChanged);
watcher.Start();