0

I have an app which is used for collection all day users collecting amount normally offline and then in the evening they uploaded amount online. Sometimes there device date and time is inaccurate so they uploaded wrong data.

At the time of collection my app is getting date and time from the device. Is there any way that app always store accurate date and time without Sim and without the Internet.

jakir hussain
  • 316
  • 2
  • 18

2 Answers2

1

Well, before searching for an app to do this. As a human how can you tell if the date/time is correct without internet? A possible solution would be a service which counts seconds from the last time the device was connected to the internet (which means it had a correct date/time at that moment) then when you want to add the new amount you can add the seconds to the last time and store this value.

Edit

You will 2 things to achieve this:

One more thing You need to be careful if the device goes off or for some reason, something stopped the service. All of these are user issues and you need to decide how much you want to handle stuff for the user. You can fix user mistakes by pushing to a SqlLite database every 10~15, but this won't fix if the device went off for hours and then started again at a wrong time - I don't think there is a possible solution for this-.

Community
  • 1
  • 1
Yamen Nassif
  • 2,416
  • 2
  • 24
  • 48
1

You can create a Sqlite Table in application cache when user switch on data,you can save current server time in that Table and in offline mode you can compare server time with current time. this is the nearest approach to get accurate time