Ensuring the correct date / time

we are creating a location-enabled application in which users use this application to record certain events in a field.

An important part of the event data is when the event occurred. This is not a problem when the user is connected to the network, but we also support situations when the user is offline (by remembering and then synchronizing events).

There may be situations when users are disconnected and they change the time on the phone, so the time of the event is mistakenly recorded.

So, what would be the best way to ensure the right time, regardless of the user's actions, given that the device can be turned off. Some ideas:

  • GPS time. Can I get it?
  • Tracking system time changes made by the user?
  • Any other idea?

Note: time requires a second accuracy, approximately a minute accuracy will be in order.

Note2: we are creating mobile applications for Android and iPhone, so I'm interested in common solutions, as well as solutions specific to any of these two platforms.

+8
android iphone
source share
2 answers

I personally would not worry so much about this scenario. The feeling that someone intentionally changes the time on their Android (which is automatically synchronized with the time server periodically during the day), while offline seems low to me. However, the only way I could compensate for this is to keep the work being done in the background, which maintains the current number of seconds elapsed since the location data was recorded offline. After downloading to your servers, you can use the elapsed seconds to calculate the time offset from the current UTC time. It is terribly much, but it will work.

GPS time is an interesting idea, but Android allows SDK users to send layouts to their devices. I'm not sure that you can reliably track changes in system time, and even if you could capture them after the fact without the current real time as context.

+2
source share

We use GPS time in our application for very similar reasons. Since our users are in different time zones, and we want local time, we determine from our server what time zone they are in during installation (they do not move very far). I didn’t think that you are mistaken in GPS locations, but for this you need to be a fairly advanced user.

+1
source share

All Articles