I am developing an android app which is time dependent. However, I faced an issue where user can change the functionality of the app by just overriding the time in their local machine which in turn provides the overridden time to the app. So, how one get the current time irrespective of what is set in local memory of a device?
Asked
Active
Viewed 85 times
0
-
see: https://stackoverflow.com/questions/13064750/how-to-get-current-time-from-internet-in-android – Mercato Jan 03 '19 at 12:41
-
https://github.com/instacart/truetime-android – Zun Jan 03 '19 at 12:41
-
clock skewing can also be detected by occasionally remembering the current time. – Martin Zeitler Jan 03 '19 at 12:46
1 Answers
0
Time in miliseconds
long millis = System.currentTimeMillis()
Time in hours
int hours = new Time(System.currentTimeMillis()).getHours();

Rezaul Karim
- 830
- 8
- 15
-
1
-
Initially I think it is the answer you wanted. but now i am guessing you are requiring the current time from internet.. you can use TimeTCPClient client for internet time – Rezaul Karim Jan 03 '19 at 12:56