Storing Sensor Data into a Text File through Isolated Storage RRS feed

  • Question

  • Well, as the title says, I am right now working on an app that takes the phone accelerometer sensor data, and I want to have this accelerometer data stored in either a CSV or text file.  I know that I must use the IsolatedStorage capability, but since I update the UI on a separate thread when reading the accelerometer data and the user interface will be updated at the interval of time I set, how can that data be first retrieved from the accelerometer, and secondly, how do I have the same data which I retrieved from the accelerometer stored in a text file?  I will really appreciate it if I can get some help in this matter!
    Tuesday, September 30, 2014 4:12 PM

All replies

  • I don't really understand the issue. You register to the ReadingChanged-Event that is surfaced by the Accelerometer object and will trigger according to your desired interval.

    Whenever the event triggers you could simply first append the text to the file and in then update the data displayed in the UI while still being in the event handler. What problem exactlly are you struggling with?

    Tuesday, September 30, 2014 4:46 PM
  • The exact problem that I am having is that I have a method call WriteFile() which will take care of the operation to take a string which is the accelerometer readings that are streaming when the accelerometer has been started.  Then I have a method call ReadFile() which theoretically would show the retrieved data which has been written to a file.  In other words, I am having the trouble of using Isolated Storage capabilities with something that is bound to a timer of sorts like with the accelerometer readings.  In essence, where would I put the WriteFile() method?  Would it be at the point at which the UI is updated?  So for example, would I put the WriteFile() method call in the UpdateUI() method?  I am really appreciative of all the assistance!  Thank you so much!
    Tuesday, September 30, 2014 8:12 PM