Mansukh Ahir
Mansukh Ahir

Reputation: 3553

How to filter Contacts on CONTACT_LAST_UPDATED_TIMESTAMP while getting contacts from Phonebook Android?

In my application i want to get contact from phone and i want to filter it on CONTACT_LAST_UPDATED_TIMESTAMP please help me how can it possible?

my query is :

 Cursor crr = cr.query(
                        ContactsContract.CommonDataKinds.Phone.CONTENT_URI,                       
 new String[] {ContactsContract.CommonDataKinds.Phone.CONTACT_ID
                                ContactsContract.CommonDataKinds.Phone.CONTACT_LAST_UPDATED_TIMESTAMP,
                                ContactsContract.CommonDataKinds.Phone.DATA_VERSION,                                
                        ContactsContract.CommonDataKinds.Phone.CONTACT_LAST_UPDATED_TIMESTAMP + " = ?",
                        new String[]{" > '1455531760472' "}, null);

but this query return 0 raw count. please show me is it right way for filter or not?

Upvotes: 1

Views: 1125

Answers (1)

Mansukh Ahir
Mansukh Ahir

Reputation: 3553

I put my own question's answer :

Cursor crr = cr.query(
                        ContactsContract.CommonDataKinds.Phone.CONTENT_URI,                       
 new String[] {ContactsContract.CommonDataKinds.Phone.CONTACT_ID
                                ContactsContract.CommonDataKinds.Phone.CONTACT_LAST_UPDATED_TIMESTAMP,
                                ContactsContract.CommonDataKinds.Phone.DATA_VERSION,                                
                        ContactsContract.CommonDataKinds.Phone.CONTACT_LAST_UPDATED_TIMESTAMP + " > ?",
                        new String[]{"1455531760472"}, null);

Upvotes: 3

Related Questions