0

gpsセンサーを使用してランナーが移動した距離を計算するWindows Phoneスポーツトラッカーアプリを開発しています。同じためにgeocoordinatewatcherクラスを使用して、移動しきい値を100に設定しています。デバイスは固定されています。私のアプリは、デバイスがその位置を変更したときにのみ距離を与える必要があります。マーケットプレイスにある他のアプリで同じバグを見つけました。どこが間違っているのか教えてください。
私のコード。

  watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
                    watcher.MovementThreshold = 150;
                    watcher.PositionChanged += watcher_PositionChanged;
                    watcher.Start();
 {
            latitudeCurrent = e.Position.Location.Latitude;
            longitudeCurrent = e.Position.Location.Longitude;
            if (stepCounter == 0)
            {
                latitudePrevious = latitudeCurrent;
                longitudePrevious = longitudeCurrent;
                distanceTravelled += Math.Round(Calculate(latitudePrevious,longitudePrevious,latitudeCurrent,longitudeCurrent),2);
                txbDistanceTravelled.Text = distanceTravelled.ToString();
                txbCalories.Text=string.Format("{0:f0}", distanceTravelled * 65);
                stepCounter++;
                var millisPerKilometer = (distanceTravelled) * (System.Environment.TickCount - _previousPositionChangeTick);
                txbPace.Text = TimeSpan.FromMilliseconds(millisPerKilometer).ToString(@"mm\:ss");
                double hrs = counterTick / 3600;
                if (!double.IsNaN((distanceTravelled / hrs)))
                {
                    txbSpeed.Text = (distanceTravelled / hrs).ToString();
                }
                else
                {
                    txbSpeed.Text = "0";
                }
}
}
4

2 に答える 2

0

テストしている場所では、GPS 信号が弱い可能性があります。屋外の場所で試してみてください。

于 2013-08-31T09:27:20.560 に答える
0

Windows Phone 7 または Windows Phone 8 用のアプリを開発していますか? 後で開発する場合は、GeoCoordinateWatcher ではなく、新しい Geolocator クラスを使用する必要があります。

また、LewisBenge が言ったように、この屋内をテストしている場合は、WiFi の位置やセルラー データを取得できます。屋外でテストする方が良いかもしれません。

于 2013-08-26T07:58:51.453 に答える