这是我获取whatsapp联系人的代码,但我无法获取联系号码。我的代码是: hatsApp它是“com.whatsapp”。所以:
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));
}
尝试了Contacts和Contacts.Data但它只显示了名称。请有人帮帮我吗?