0

I am working in an Android application where i have to capture and save data locally with current Date & Time, later which will sent to the web server.

Now the issue is if user changed the Date & Time of Handset, application stores wrong data.

I need to get current Date & Time from Network Provider or some other way in LOW OR NO Network area, because in proper network i can get Web Server Date & Time, so i have to work for low or no Network area.

Thanks in Advance:)

ANKIT
  • 431
  • 1
  • 10
  • 22
  • Well if you have no network, how would the device know the "correct" time? The only thing it has is its own date... – Guillaume Dec 13 '11 at 09:49

3 Answers3

0

You can take a look at this solution on how to programatically get network-provided values in your code. This should solve the problem provided the web server also uses network-provided date and time.

Community
  • 1
  • 1
josephus
  • 8,284
  • 1
  • 37
  • 57
0

Use local time stamping which is updated periodically. Sync the timer on network connection then keep a check if the user has manipulated the time, the stamps will be invalid. Idea is similar to web certificates.

Abhinava
  • 1,030
  • 9
  • 19
0

As a workaround you could use GPS time, will be off by a bit but better than nothing and available most of the time.

NikkyD
  • 2,209
  • 1
  • 16
  • 31