【发布时间】:2016-05-12 09:48:18
【问题描述】:
我正在使用 android 登录 Facebook 登录后我想从 Facebook 保存数据我想从 Facebook 保存以下数据
- 名字
- 中间名
- 姓氏
- 用户名
- 头像
- 电子邮件
- 个人资料名称
我尝试了以下代码
loginButton = (LoginButton)findViewById(R.id.login_button);
loginButton = (LoginButton) findViewById(R.id.login_button);
loginButton.setReadPermissions(Arrays.asList("public_profile", "email", "user_friends"));
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
AccessToken accessToken = loginResult.getAccessToken();
Profile profile = Profile.getCurrentProfile();
String userid = profile.getId();
String userfirstname = profile.getFirstName();
String middlename = profile.getMiddleName();
String userlastname = profile.getLastName();
Uri userimage = profile.getProfilePictureUri(30, 40);
String name = profile.getName();
}
@Override
public void onCancel() {
//info = ("Login attempt canceled.");
}
@Override
public void onError(FacebookException e) {
// info = ("Login attempt failed.");
}
});
从上面的代码我成功地得到了其他所有但不能得到电子邮件。
我想要什么
- 我想获取用户电子邮件
- 我想为 HTTP CALL 创建一个新的 json 数组来保存用户帐户中的上述数据。
【问题讨论】:
-
我认为您的问题与内容无关
标签: android facebook android-studio facebook-sdk-4.0