In the following code fragment, a contact list is retrieved which has the ACCOUNT_TYPE="com.whatsapp".
Cursor c = getContentResolver().query(
ContactsContract.RawContacts.CONTENT_URI,
new String[]{ContactsContract.RawContacts.CONTACT_ID,
ContactsContract.RawContacts.DISPLAY_NAME_PRIMARY},
ContactsContract.RawContacts.ACCOUNT_TYPE + "= ?",
new String[]{"com.whatsapp"},
"display_name ASC");
From experimenting with code, I have found that ACCOUNT_TYPE can be several things at once. eg. it can be equal to "com.whatsapp" and "com.google".
When I run a the method c.getCount() on the above cursor, I get 956 contacts. While the same command returns 1305 for "com.google", which is the total number of contacts on the device. All of the contacts are Google contacts while 956 of them are Whatsapp contacts.
I am trying to get the contacts on the device which are NOT Whatsapp contacts. I tried the following:
Cursor c = getContentResolver().query(
ContactsContract.RawContacts.CONTENT_URI,
new String[]{ContactsContract.RawContacts.CONTACT_ID,
ContactsContract.RawContacts.DISPLAY_NAME_PRIMARY},
ContactsContract.RawContacts.ACCOUNT_TYPE + "!= ?",
new String[]{"com.whatsapp"},
"display_name ASC");
Note : != instead of =
This did NOT work.
I tried:
Cursor c = getContentResolver().query(
ContactsContract.RawContacts.CONTENT_URI,
new String[]{ContactsContract.RawContacts.CONTACT_ID,
ContactsContract.RawContacts.DISPLAY_NAME_PRIMARY},
ContactsContract.RawContacts.ACCOUNT_TYPE + "!= ? and " +
ContactsContract.RawContacts.ACCOUNT_TYPE + "= ?",
new String[]{"com.whatsapp,"com.google"},
"display_name ASC");
This did not work either.
Please help..
How can I get a list of contact which are NOT on a specific account type (e.g. Whatsapp)?
Muchos Gracias. Danke.
Cursor c = getContentResolver().query(
ContactsContract.RawContacts.CONTENT_URI,
new String[]{ContactsContract.RawContacts.CONTACT_ID,
ContactsContract.RawContacts.DISPLAY_NAME_PRIMARY},
ContactsContract.RawContacts.ACCOUNT_TYPE + "= ?",
new String[]{"com.whatsapp"},
"display_name ASC");
From experimenting with code, I have found that ACCOUNT_TYPE can be several things at once. eg. it can be equal to "com.whatsapp" and "com.google".
When I run a the method c.getCount() on the above cursor, I get 956 contacts. While the same command returns 1305 for "com.google", which is the total number of contacts on the device. All of the contacts are Google contacts while 956 of them are Whatsapp contacts.
I am trying to get the contacts on the device which are NOT Whatsapp contacts. I tried the following:
Cursor c = getContentResolver().query(
ContactsContract.RawContacts.CONTENT_URI,
new String[]{ContactsContract.RawContacts.CONTACT_ID,
ContactsContract.RawContacts.DISPLAY_NAME_PRIMARY},
ContactsContract.RawContacts.ACCOUNT_TYPE + "!= ?",
new String[]{"com.whatsapp"},
"display_name ASC");
Note : != instead of =
This did NOT work.
I tried:
Cursor c = getContentResolver().query(
ContactsContract.RawContacts.CONTENT_URI,
new String[]{ContactsContract.RawContacts.CONTACT_ID,
ContactsContract.RawContacts.DISPLAY_NAME_PRIMARY},
ContactsContract.RawContacts.ACCOUNT_TYPE + "!= ? and " +
ContactsContract.RawContacts.ACCOUNT_TYPE + "= ?",
new String[]{"com.whatsapp,"com.google"},
"display_name ASC");
This did not work either.
Please help..
How can I get a list of contact which are NOT on a specific account type (e.g. Whatsapp)?
Muchos Gracias. Danke.