如何通过 ContactsContracts API 获取用户的 facebook id?

发布于 2024-10-08 07:00:36 字数 267 浏览 0 评论 0原文

我将地址簿与 Facebook 同步,现在可以通过地址簿访问我的 Facebook 个人资料。 我想从另一个应用程序读取连接到帐户的 facebook 数据并获取同步用户的 facebook id。

我在 ContactContracts.Data 表中找不到包含与 facebook 相关的内容的 mimetype 或数据字段。有人成功做到过吗?

Facebook 似乎以某种方式限制了对此数据的权限。这是如何完成的?我需要哪些权限才能访问地址簿中同步的 Facebook 联系信息?

I synced my address book with facebook and can now access my facebook profile through my addressbook.
I want to read the facebook data that is connected to the account from another application and get the facebook id of the synced user.

I can't find a mimetype or a datafield in the ContactContracts.Data table that contains something related to facebook. Has anybode done this successfully?

It seems that facebook somehow restricts the permissions to this data. How is this done and which permissions do I need to access the facebook contact informations that are synced in the address book?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

单挑你×的.吻 2024-10-15 07:00:36

如果用户的联系人中有该信息,那么他们在 Facebook 上也是该人的好友。只需使用图形 api 并获取朋友列表,并使用所选的联系人姓名对其进行过滤,或者让用户从由 facebook api 查询返回的名称组成的列表视图中进行选择。

try {
    JSONObject response = Util.parseJson(facebook.request(
    "/me/friends", new Bundle(), "GET"));

    JSONArray jArray = response.getJSONArray("data");

    for (int i = 0; i < jArray.length(); i++) {
        JSONObject json_data = jArray.getJSONObject(i);
        tempMap = new HashMap<String, Object>();
        tempMap.put("friend", json_data.getString("name"));
        tempMap.put("id", json_data.getString("id"));
        friendlist.add(tempMap);
    }
} catch (MalformedURLException e) {
    e.printStackTrace();
} catch (JSONException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
} catch (FacebookError e) {
    e.printStackTrace();
}

If the user has that info in their contacts, then they are also friends with that person on facebook. Just use the graph api and get the list of friends and filter them with the contact name selected or let the user select from a listview which is made from the returned names of the facebook api query.

try {
    JSONObject response = Util.parseJson(facebook.request(
    "/me/friends", new Bundle(), "GET"));

    JSONArray jArray = response.getJSONArray("data");

    for (int i = 0; i < jArray.length(); i++) {
        JSONObject json_data = jArray.getJSONObject(i);
        tempMap = new HashMap<String, Object>();
        tempMap.put("friend", json_data.getString("name"));
        tempMap.put("id", json_data.getString("id"));
        friendlist.add(tempMap);
    }
} catch (MalformedURLException e) {
    e.printStackTrace();
} catch (JSONException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
} catch (FacebookError e) {
    e.printStackTrace();
}
一生独一 2024-10-15 07:00:36

您还可以考虑使用 gigya.com 提供的 API 和 android SDK(我曾经在其中使用过)直到最近才工作)。

You can also consider working with the APIs and android SDK offered by gigya.com (where I used to work until recently).

你如我软肋 2024-10-15 07:00:36

到目前为止,这对于官方 API 来说似乎是不可能的,因为 例外,这是 Google 为 Facebook 应用程序创建的。我希望 Facebook 在其下一个版本中遵守官方 Android API。

It seems that this is not possible to the official API until now because of this exception that was made for the facebook app by google. I hope facebook complies with the offical android API in its next versions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文