如何获取已通过 Facebook 同步适配器同步到 native 联系人应用的联系人的 facebook id 或 url?
我浏览了不同的网址,但没有看到任何关于 facebook 的信息。
我试过了
ContactsContract.Data.CONTENT_URI
ContactsContract.CommonDataKinds.Email.CONTENT_URI
ContactsContract.CommonDataKinds.Phone.CONTENT_URI
ContactsContract.Contacts.CONTENT_URI
因为 URI 已经在下面的代码中:
Uri uri = ContactsContract.Data.CONTENT_URI;
Cursor c = getContentResolver().query(uri, null, null, null, null);
while (c.moveToNext()) {
for (int i=0; i<c.getColumnCount(); i++) {
Log.d(TAG, c.getColumnName(i) + ": " + c.getString(i));
}
Log.d(TAG, "==================================");
}
我确实得到了一个像这样的列值
contact_status_res_package: com.facebook.katana
在此转储中,我还获得了联系人状态(contact_status 列),但我在任何地方都看不到此联系人的 facebook url 或 id。
最佳答案
在 Google Group (http://groups.google.com/group/android-developers/browse_thread/thread/95110dd7a1e1e0b4) 上得到回复:
Access to Facebook friends via the contacts provider is restricted to a handful of system apps by the provider itself. Other applications cannot read that data.
因此,现在我通过 FB Graph api (http://graph.facebook.com/me/friends) 获取所有联系人姓名/ID 映射的缓存,并将其用于 ID 查找。
关于android - 如何从 native 联系人/内容解析器获取联系人的 facebook id 或 url?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4506571/