[英]facebook login error. unable to get user_birthday and user_location
嗨,我正在使用Facebook登录到我的应用程序。 我无法获得用户
生日和来自Facebook的用户位置。 以下是用于从用户那里获取详细信息的方法。 我正在使用活动类进行登录。
private void loginFacebook() {
// TODO Auto-generated method stub
if (!facebook.isSessionValid()) {
final Session.OpenRequest request = new
Session.OpenRequest(LoginActivity.this);
facebook.authorize(this, new String[] {
"email","user_birthday","user_about_me","user_location"
}, new LoginDialogListener());
} else {
getProfileInformation();
}
}
public void getProfileInformation() {
// TODO Auto-generated method stub
try {
profile = Util.parseJson(facebook.request("me"));
mUserId = profile.getString("id");
Gloabalvariables.setUserID(mUserId);
mUserToken = facebook.getAccessToken();
mUserName = profile.getString("name");
mUserEmail = profile.getString("email");
JSONObject c=new JSONObject(profile.getString("location"));
mUserhomeTown=c.getString("name");
new insertintoServer().execute();
//getOnlineFreindList();
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(), "Name: " + mUserName "\nEmail+"+ mUserEmail, Toast.LENGTH_LONG).show();
}
});
} catch (FacebookError e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
这里的问题是,我只能从我创建应用程序ID的帐户中从用户获取user_birthday和user_location。 对于其他帐户,我无法获取这些详细信息。 我奋斗了两天。 但是我发现我在代码中做错了什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.