I want to get all contacts in device. So I queried contacts by ContentResolver as below. But contacts from facebook were not appeared while the default contact app in android is showing every contacts. Because default contact app is showing contacts from facebook, I thought that the contacts must be inserted in db that ContactProvider accessing, so there must some way to get them.
(Because google has disabled synchronizing facebook contact, I synchronized facebook contacts by clicking synchronizing contact button in facebook app.)
So..my question is..How can I get contacts from facebook. Thanks..!!
Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
String[] projection = new String[] {
ContactsContract.CommonDataKinds.Phone.CONTACT_ID,
ContactsContract.CommonDataKinds.Phone.NUMBER,
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME
};
Cursor contactCursor = getContentResolver().query(uri, projection, null, null, null);
if (contactCursor.moveToFirst()) {
do {
// get contacts...
} while (contactCursor.moveToNext());
}
contactCursor.close();