If I use asynch call the application function but not like I want. If I use the synch call the application doesn't function and crashes when I launch it. (Unable to resume activity: NetworkOnMainThreadException) Why??
private void makeFBRequest(final Session session) {
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (session == Session.getActiveSession()) {
if (user != null) {
Profile.name = user.getFirstName();
Profile.surname = user.getLastName();
Profile.email = (String) user.asMap().get("email");
}
}
});
//request.executeAsync();
request.executeAndWait();
}