gpt4 book ai didi

android - 在 Android 中从 Facebook 请求检索电子邮件和位置时出错

转载 作者:太空宇宙 更新时间:2023-11-03 11:58:21 25 4
gpt4 key购买 nike

我在 native Android 中使用 facebook sdk 3.5。这就是我获取 Facebook 好友 ID/名称的方式:

private void onSessionStateChange(final Session session,
SessionState state, Exception exception) {
System.out.println("onSessionStateChanged");
if (session != null && session.isOpened()) {
if (state.equals(SessionState.OPENED_TOKEN_UPDATED)) {
tokenUpdated();
} else {
getUserRequest(session);
getFriendsRequest(session);
}
} else {
profilePictureView.setProfileId(null);
userNameView.setText("");
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(getActivity(), requestCode,
resultCode, data);
// uiHelper.onActivityResult(requestCode, resultCode, data,
// nativeDialogCallback);
}


private void getFriendsRequest(Session session) {

session.requestNewReadPermissions(new NewPermissionsRequest(
getActivity(), PERMISSIONS));
final ProgressDialog dialog = new ProgressDialog(getActivity());
// get friends details
Request request = Request.newMyFriendsRequest(session,
new Request.GraphUserListCallback() {

@Override
public void onCompleted(List<GraphUser> users,
Response response) {

// if no errors
if (response.getError() == null) {
if (users != null) {
for (GraphUser user : users) {
FacebookFriend fb = new FacebookFriend(user
.getId(), user.getName(), "", "",
"", 0);
friends.add(fb);
}

....
}
}

响应现在是:

{Response:  responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"data":[{"id":"213","name":"Test name"}]}}, error: null, isFromCache:false}

这里一切都很好,但电子邮件(如果共享)、位置、用户名等详细信息不在:

GraphObject{graphObjectClass=GraphUser, state={"id":"60711232217","name":"Test"}}

我应该在哪里设置权限?这是我的要求:

{Request:  session: {Session state:OPENED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[email, user_location, user_friends, friends_location, basic_info]}, appId:111111}, graphPath: me/friends, graphObject: null, restMethod: null, httpMethod: GET, parameters: Bundle[{access_token=dasdasdasdasdsada, format=json, sdk=android, migration_bundle=fbsdk:20130708}]}

我应该在哪里添加这些权限以获得更多详细信息?

谢谢。

最佳答案

Go to this link Graphapilink

Click the Graph API Explorer icon-> Then select your application name "YourApplication"-> Then click the GetAccesTocken .it show the Select Permission Pop Up window.->Then you select the Extended Permission tab.

enter image description here

Finally you will be select the necessary permission you want as the picture above

关于android - 在 Android 中从 Facebook 请求检索电子邮件和位置时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18781686/

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