I\'m currently creating a test application to test using the latest facebook SDK to update our existing application problem is that I need to get the email address which I k
You can also use GraphResponse object to get the values
LoginManager.getInstance().registerCallback(callbackManager,
new FacebookCallback()
{
@Override
public void onSuccess(LoginResult loginResult)
{
GraphRequest request = GraphRequest.newMeRequest(
loginResult.getAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject object, GraphResponse response) {
Log.v("LoginActivity", response.toString());
try {
// Application code
String email = response.getJSONObject().getString("email");
txtStatus.setText("Login Success \n" + email);
}catch(Exception e){
e.printStackTrace();;
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,email,gender,birthday");
request.setParameters(parameters);
request.executeAsync();
}
@Override
public void onCancel()
{
txtStatus.setText("==============Login Cancelled=============");
}
@Override
public void onError(FacebookException exception)
{
txtStatus.setText("==============Login Error=================");
exception.printStackTrace();
}
});