0
我使用GeoCoordinateWatcher檢測的windows phone的logitude和緯度7PositionChanged事件GeoCoordinateWatcher在WP7
我做了以下
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
// Add event handlers for StatusChanged and PositionChanged events
watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);
watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);
watcher.MovementThreshold = 100;
// Create A Timer for Getting the GPS Cooradinate every 10 seconds only
System.Windows.Threading.DispatcherTimer dt = new System.Windows.Threading.DispatcherTimer();
// Start the Location service in the First time when the Application run
StartLocationService();
// 15 minutes the interval of timer
dt.Interval = new TimeSpan(0, 0, 0, 10, 0);
// Add the Tick Method for event Handler
dt.Tick += new EventHandler(Start_Service);
// Start the Timer
dt.Start();
}
在start_service方法
我打電話watcher.start
問題是,即使位置沒有改變,每10秒調用一次watcher_PositionChanged! ,我知道
watcher.MovementThreshold = 100;
會當行駛距離爲100以上 watcher_PositionChanged方法被調用但是,這並沒有發生
注:我測試使用模擬器
但我設置watcher.MovementThreshold和我改變我的位置和positionChanged事件沒有被解僱 – Developer