My issue is, when I'm fetching contacts from phone, it will get all the contacts (from phone, SIM, social accounts etc)
i want to know, if I can get contacts from social accounts separately?
If you need to sync, head to the “Mail Contacts and Sync” for iPhone or “Accounts & Sync” for Android and make sure the “Sync” option is enabled. Once you've done this your phone will import contacts from Facebook and you will be able to see them in your contacts.
On your Android phone or tablet, open the "Settings" app. Tap Google. Settings for Google apps. Google Contacts sync.
As long as the contacts for the applications are synced, you can query the RawContacts
(with the READ_CONTACTS
permission in your manifest) and get them filtered by account type. For example:
Cursor c = getContentResolver().query(
RawContacts.CONTENT_URI,
new String[] { RawContacts.CONTACT_ID, RawContacts.DISPLAY_NAME_PRIMARY },
RawContacts.ACCOUNT_TYPE + "= ?",
new String[] { <account type here> },
null);
ArrayList<String> myContacts = 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.
myContacts.add(c.getString(contactNameColumn));
}
It's just a matter of supplying the appropriate account type. For example:
"com.google"
for Gmail,"com.whatsapp"
for WhatsApp,"com.skype.contacts.sync"
for Skype,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