I have an application which records information using a tablet which is sync’ed to a server where reports are then run on the results. The users spend all day using the tablets and travel a lot throughout the day.
The time when the users complete these tasks is crucial to the reports and we have had several occurrences where we can’t rely on the device time.
- The user sometimes manually sets the time to something different on the device in order to look like they have done more work – this happens more than we expected
- When relying on the time set to ‘automatic’, the time sometimes jumps around as the users travel between networks
- When the tablet is initially switched on, sometimes the device time is set to 1970
I have a webservice to get the server time which is not currently used because we can’t rely on the users having internet connection because they generally don’t have any connection at all due to the nature of the work. However, they sync the data everyday usually, or at least once every few days.
I’d like to create something that gets the server time and counts the time from then on and the app would use this time. Any time they connect, this time will be updated, just to make certain the time is synced. Does anyone have any suggestions as to the best way to do this? Bear in mind that the time that we send up is crucial – it could be the case that if misreported on several occasions, someone could lose their job.
Thanks in advance!
I left this unfinished, but have now implemented a solution.
I’ve created a Service which runs in the background, and downloads the date at intervals from a webservice, and uses a Timer to increment the time in between calls to the webservice.
Further to this, I use GPS to get the current time and date, and it uses this if possible, and if not then it uses this internal clock.
The time should be right most of the time, in theory!