是否可以通过Android中的Skype帐户获取联系人?

hha*_*ech 6 android skype

我已经在我的应用程序中使用Intent实现了Skype视频/音频调用功能,它工作正常.但现在我想从Skype帐户获取所有联系人列表是否可能?

是否有任何其他方式来显示Skype帐户的联系人列表请提出任何建议?

mat*_*ash 3

可以向提供商查询所有联系人(只要它们已同步)ContactsContract。RawContacts.ACCOUNT_TYPE表的列指示RawContacts每个条目的帐户类型(“原始”意味着它包含所有条目,例如具有多个聚合联系人的单个人的多行)。

要读取 Skype 联系人,您可以执行以下操作:

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));
}
Run Code Online (Sandbox Code Playgroud)

请务必同时请求文件android.permission.READ_CONTACTS中的权限AndroidManifest.xml。