I've created a simple app which reads location data (latitude, longitude, speed, altitude) every few seconds using GooglApiClient
. I would like to record the data, so that I would be able to calculate and show: distance, average speed, min and max altitude, trace on the map etc. in real-time to the user. Which data storing method would be the best for this purpose? I don't want to see the implementation of this method from you, just want to know which method would be the best. I was thinking about sqLite database, but isn't it too slow and energy consuming for continous read-write operations.
To answer your question I think you need to know more about how much data you are going to be recording (how long are you tracking) what you need to do with the data (all remote or posting to servers, etc.) and what sort of devices are you targeting. I think your two options are either Sqlite or storing as a file. Both these options should be fine from a power and speed point of view, the main power issue will be you accessing the GPS sensor, not writing to db or file.
If you chose to write to a file, there are a least 3 (and there are many more) useful formats you can stream a file to that you should be aware of. They are:
GPS Exchange Format this is an open standard used by many commercial gps and satnav applications which is used to describe waypoints, tracks, and routes
Geography Markup Language which is an open xml standard for expressing geographical features which is understood by almost all GIS applications
GeoJSON which is a standard for describing geographical features in json, which is easy then to render in a web browser.
If you need to you could easily serialize from a Sqlite data set to these file fomats for data interchange. One thing about streaming to files on Android devices. However you write your file writer, it may get arbitrarily destroyed by the OS due to memory conditions or user priorities. This could well mean you end up with malformed files with streams not closed. This is a lot less likely to happen if you are writing to data tables.