Is it possible to get contacts from my Skype account in android?

不羁岁月 提交于 2019-12-13 12:08:27

问题


I have implemented Skype video/audio calling functionality using Intent in my application it is working fine. But now I want to get all contacts list from Skype account is it possible?.

Is there any alternate way to show list of contacts of Skype account please give any idea?


回答1:


All contacts (provided they are synced) can be queried with the ContactsContract provider. The RawContacts.ACCOUNT_TYPE column of the RawContacts table indicates the account type for each entry ("raw" means that it contains all entries, e.g. multiple rows for a single person with multiple aggregated contacts).

To read the Skype contacts, you can do something like this:

Cursor c = getContentResolver().query(
                RawContacts.CONTENT_URI,
                new String[] { RawContacts.CONTACT_ID, RawContacts.DISPLAY_NAME_PRIMARY },
                RawContacts.ACCOUNT_TYPE + "= ?",
                new String[] { "com.skype.contacts.sync" },
                null);

int contactNameColumn = c.getColumnIndex(RawContacts.DISPLAY_NAME_PRIMARY);
ArrayList<String> mySkypeContacts = new ArrayList<String>();

while (c.moveToNext())
{
    /// You can also read RawContacts.CONTACT_ID to query the 
    // ContactsContract.Contacts table or any of the other related ones.
    mySkypeContacts.add(c.getString(contactNameColumn));
}

Be sure to also request the android.permission.READ_CONTACTS permission in the AndroidManifest.xml file.



来源:https://stackoverflow.com/questions/23632350/is-it-possible-to-get-contacts-from-my-skype-account-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!