0

This is my code for getting whatsapp contacts but i can't getting contact numbers. My code is: hatsApp 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())
    {
        myWhatsappContacts.add(c.getString(contactNameColumn));
    }

Tried both Contacts and Contacts.Data but it is only showing only names . Can anybody help me please?

Maxim Korobov
  • 2,574
  • 1
  • 26
  • 44
Kannan
  • 51
  • 1
  • 8

0 Answers0