Hi i want to get contact which are used by other application (like whatsapp or viber ) please see in below image
please help me about this issue thanks
WhatsApp quickly and easily recognizes which of your contacts are using WhatsApp by accessing your phone's address book. To find your favorites/contacts go to the Chats tab and tap the New chat icon. If you can't see your contacts: Make sure that your contacts are using WhatsApp.
In apps that use phone authentication like whatsapp: When any user opens to check his/her contacts, whatsapp will show only the contacts from your phone that are using whatsapp (like they filter your contacts).
When you use contact upload and grant WhatsApp access to your device address book, WhatsApp will access and upload the phone numbers in your address book typically daily, but this depends on various factors including how often a user uses WhatsApp, including those of WhatsApp users and your other contacts.
With the READ_CONTACTS
permission in your manifest, you can get synced contacts given the account type. For WhatsApp it's "com.whatsapp"
. So:
Cursor c = getContentResolver().query(
RawContacts.CONTENT_URI,
new String[] { RawContacts.CONTACT_ID, RawContacts.DISPLAY_NAME_PRIMARY },
RawContacts.ACCOUNT_TYPE + "= ?",
new String[] { "com.whatsapp" },
null);
ArrayList<String> myWhatsappContacts = new ArrayList<String>();
int contactNameColumn = c.getColumnIndex(RawContacts.DISPLAY_NAME_PRIMARY);
while (c.moveToNext())
{
// You can also read RawContacts.CONTACT_ID to read the
// ContactsContract.Contacts table or any of the other related ones.
myWhatsappContacts.add(c.getString(contactNameColumn));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With