Last active
August 29, 2015 14:03
-
-
Save ppapageorgiou/38b5b4ea4c38b8d6994a to your computer and use it in GitHub Desktop.
Open Facebook Session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void openFacebookSession() { | |
// Open a Facebook session to get the user's name | |
Session.openActiveSession(this, true, new Session.StatusCallback() { | |
@Override | |
public void call(Session session, SessionState state, Exception exception) { | |
if (session.isOpened()) { | |
Request.newMeRequest(session, new Request.GraphUserCallback() { | |
// Response Callback | |
@Override | |
public void onCompleted(GraphUser user, Response response) { | |
if (user != null) { | |
TextView welcome = (TextView) findViewById(R.id.welcomeText); | |
welcome.setText("Welcome " + user.getFirstName() + "!"); | |
} | |
} | |
}).executeAsync(); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment