Date and Time update to check if you are online

Asked

Viewed 53 times

1

In my android app I have a service that sends from time to time a user location and saves in another field lastUpdate the day and time that happened the update. Currently use Calendar.getInstance().getTime() to take Date and send it to the bank, but what I realize is that the time of many times is more advanced than the current time, what to do to standardize?

1 answer

1


For everything to work as you want, the device that receives the date must be synchronized with the machine where the server is. There’s no turning back this situation.

The Calendar.getInstance().getTime() depends on android device date/time.

However if you have already done some kind of synchronization and the error happens at a reduced scale I advise you to use the System.currentTimeMillis(); to make the comparisons.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.