Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-187

WP7 Issues with Accelerometer.cs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.3.0
    • 1.4.0
    • cordova-wp7 (DEFUNCT)
    • On Windows Phone in italian language

    Description

      There is a bug in the Accelerometer.cs. The formattated date won't be parsed on some CultureInfo because of the decimal separator. The solution is pretty simple, add CultureInfo.InvariantCulture to the ToString method.

      Here is how it should look:
      private string GetCurrentAccelerationFormatted()
      {
      string resultCoordinates = String.Format("\"x\":

      {0}

      ,\"y\":

      {1}

      ,\"z\":

      {2}

      ",
      accelerometer.CurrentValue.Acceleration.X.ToString("0.00000", CultureInfo.InvariantCulture),
      accelerometer.CurrentValue.Acceleration.Y.ToString("0.00000", CultureInfo.InvariantCulture),
      accelerometer.CurrentValue.Acceleration.Z.ToString("0.00000", CultureInfo.InvariantCulture));
      resultCoordinates = "

      {" + resultCoordinates + "}

      ";
      return resultCoordinates;
      }
      To reproduce the error set you phone to italian and you will see you won't get the notifications

      Attachments

        Activity

          People

            purplecabbage Jesse MacFadyen
            dan.ardelean Dan Ardelean
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified