I'm trying to get all Telegram contacts to use in my application ,here is my code :
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[] { "org.telegram.messenger.account" },
null);
ArrayList<String> myTelegramappContacts = new ArrayList<String>();
int contactNameColumn = c.getColumnIndex(ContactsContract.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.
myTelegramappContacts.add(c.getString(contactNameColumn));
}
but it doesn't return me any contact!
what's my problem?
is org.telegram.messenger.account
true for account type?or where can I find what is account type for telegram ?
Thanks for your attention.
finally found ,the true Account_Type for telegram is
and also ,can find all account type in a phone by this code:
hope to help anybody els.