I am using the Facebook SDK to allow users to login using Facbook, but I am unable to fetch profile details after a successful login.
Here is my code:
fbLoginButton = (LoginButton) findViewById(R.id.login_button);
fbLoginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Profile profile = Profile.getCurrentProfile();
id = profile.getId();
String user_fname = profile.getFirstName();
String user_lname = profile.getLastName();
user = user_fname.concat(" ");
user = user.concat(user_lname);
image = profile.getProfilePictureUri(10, 10).toString();
try {
send();
}catch (Exception ex) {
String error = ex.getMessage();
}
}
It gives an error that profile obj is null