I want to get the current date that is not dependant on the mobile time. If user change the date in mobile then also it will return the present date. How can I get the current date that is not generated by the mobile?
Asked
Active
Viewed 50 times
1
-
2refer this post http://stackoverflow.com/questions/13064750/how-to-get-current-time-from-internet-in-android – userDroid Aug 18 '15 at 08:35
1 Answers
0
Try this code:
try {
TimeTCPClient updateTime = new TimeTCPClient();
try {
updateTime.setDefaultTimeout(60000);
updateTime.connect("your time server name...");
Log.d("TimeLog", client.getDate() + "");
} finally {
updateTime.disconnect();
}
} catch (IOException e) {
e.printStackTrace();
}

kiturk3
- 549
- 10
- 30