I am developing an android apps currently, in some of my function required to get the date time from the phone, but assuming user may change their phone date time at their willing, in this case my application will display wrong result. I am using timestamp as the data type for my date time btw, so how to ensure that I am getting the most accurate date time from the phone without concerning user modify the phone date time.
Calendar dateTime=Calendar.getInstance();
long milliseconds=dateTime.getTimeInMillis();
As you see the code above is getting date time from the phone itself which means it may inaccurate due to user modify their date time in the phone. Anyone please toss an solution or idea to me about how to do this is correct way. Thx and Sorry for my broken english
the Calendar : it's based on the device time settings/timezone. Quote from the doc: "Calendar's getInstance method returns a calendar whose locale is based on system settings and whose time fields have been initialized with the current date and time"
but for my question is what if user change the time settings??