Reputation: 167
How does android calculate the value for last time contacted. It provides the value in integer format but I am unable to decipher the given value. For example what if I want to compare the two give values to know which contact has been contacted later. Any type of help would be appreciated.
Upvotes: 2
Views: 2489
Reputation: 951
The value you receive is returned in long format and holds the date and time information of the last time called has happened from a particular number.
It returns the milliseconds of that number.
For your reference: http://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns.html#LAST_TIME_CONTACTED
Now how to compute date and time here is the link: how to convert milliseconds to date format in android?
How to compare: There are functions "before" and "after" which tells whether the event date is before or after another specified date
Date class: http://developer.android.com/reference/java/util/Date.html#after(java.util.Date)
or
Calendar class: http://developer.android.com/reference/java/util/Calendar.html#after(java.lang.Object)
Depends which one you want to use.
I hope it helps and let me know for more info.
Upvotes: 1
Reputation: 10039
Every time you contact someone, (i.e. make the call Contacts.markAsContacted) the TIMES_CONTACTED should increment by 1 and LAST_TIME_CONTACTED should be updated. However, many device manufacturers have changed this functionality and it is not reliable anymore. There is an open bug for this issue which you could find at
Upvotes: 0