问题描述
我已经在我的应用程序中使用Intent实现了Skype视频/音频呼叫功能,它运行正常.但是现在我想从Skype帐户获取所有联系人列表吗?
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?.
还有其他显示Skype帐户联系人列表的方法吗?
Is there any alternate way to show list of contacts of Skype account please give any idea?
推荐答案
可以使用 ContactsContract
提供程序. 的
表指示每个条目的帐户类型(原始"表示它包含所有条目,例如,具有多个汇总联系人的单个人的多行). RawContacts.ACCOUNT_TYPE
列RawContacts
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).
要阅读Skype联系人,您可以执行以下操作:
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));
}
请确保还要在 AndroidManifest.xml
文件中请求 android.permission.READ_CONTACTS
权限.
Be sure to also request the android.permission.READ_CONTACTS
permission in the AndroidManifest.xml
file.
这篇关于是否可以从Android中的Skype帐户获取联系人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!