android-contentproviderandroid-contactsandroid-contentresolvercontactscontract

LAST_TIME_CONTACTED has unexpected value


When I try to get the last time that I contacted some contacts, the results has the value converted to "01/01/1970" but I know the real date and time of the last call (for example, it is 14/02/2016). I noted that in my logs the last saved call is that was at one and half year ago, but the call I try to find was in 2 years ago.

So, am I correct in understanding that after some long time the log loses the older calls and in the contacts2.db the last_time_contacted field updates to incorrect values?


Solution

  • LAST_TIME_CONTACTED is not somehow linked to the call log, it's just a timestamp value that is set on the contact.

    01/01/1970 means a value of 0 for that field, i.e. that contact never had its LAST_TIME_CONTACTED value set, this can happen if that contact was recreated (re-synced, merged, split, etc.) since it was last contacted, erasing the previously set value.

    Also note that LAST_TIME_CONTACTED can be updated not just by calls - sms, whatsapp, email apps, even social apps can and do update this value for a contact that was contacted via the app.