gpt4 book ai didi

android - 是否可以从 android 中的 Skype 帐户获取联系人?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:11:06 25 4
gpt4 key购买 nike

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

是否有任何替代方法来显示 Skype 帐户的联系人列表,请提供任何想法?

最佳答案

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

要读取 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));
}

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

关于android - 是否可以从 android 中的 Skype 帐户获取联系人?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23632350/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com