简体   繁体   English

Facebook SDK Android,获取关联帐户

[英]Facebook SDK android, get connected accounts

A facebook user can control multiple pages. 一个facebook用户可以控制多个页面。 For example, a user can have their personal facebook account, their public figure page and their business page. 例如,用户可以拥有其个人Facebook帐户,其公众人物页面和其业务页面。 This shows up as three distinct accounts with their own User information in facebook's server. 这显示为三个不同的帐户,它们在facebook的服务器中具有自己的User信息。

I want to list these things, how can I retrieve what these accounts are using the Facebook SDK? 我想列出这些东西,如何使用Facebook SDK检索这些帐户呢?

I feel like it has to do with the Request.newMeRequest method, but this returns a GraphUser object. 我觉得它与Request.newMeRequest方法有关,但这返回了GraphUser对象。

and the Request.newMyFriendsRequest returns a list of users, but not a list of the personal account's connected accounts. 然后Request.newMyFriendsRequest返回用户列表,但不返回个人帐户的关联帐户列表。

edit I am now using this 编辑我现在正在使用这个

 new com.facebook.Request(
                            session,
                            "/me/accounts",
                            null,
                            HttpMethod.GET,
                            new com.facebook.Request.Callback() {

                                @Override
                                public void onCompleted(com.facebook.Response response) {
                                    if(response!=null && response.getGraphObjectList()!=null){

                                    }
                                }
                            }
                    ).executeAsync();

but response is null. response为空。 My session has the manage_pages permission requested as well 我的会话也请求了manage_pages权限

edit I tried replacing "/me/accounts" with "/"+userId+"/accounts" and I still get back a null response. 编辑我尝试用"/me/accounts" "/"+userId+"/accounts"替换"/me/accounts" "/"+userId+"/accounts" ,但我仍然返回空响应。 Baffling. 莫名其妙。

Insight appreciated 洞察力赞赏

You can test this procedure at Graph Api Explorer -> Just click on 'Get Access Token' button-> under 'Extended permission' check 'manage_pages' & submit it. 您可以在Graph Api Explorer中测试此过程->只需单击“扩展权限”下的“获取访问令牌”按钮->选中“ manage_pages”并提交。 It will give you the admin-page-details JSON. 它将为您提供admin-page-details JSON。 And please see Graph API Reference /{user-id}/accounts 并且请参阅Graph API参考/ {user-id} / accounts

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM