I'm working on android Login with Facebook After login i want to save the data from Facebook i want to save the following data from Facebook
- First Name
- Middle Name
- Last Name
- User id
- profile picture
- Profile Name
I tried some code which following
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.");
}
});
From above code i successfully get other all but can't get email.
What i want
- I want to get user email
- I want to create a new json array for HTTP CALL to save the above data from user account.