I've got a problem - I'm developing an app with facebook login and also I need to get User data, for somewhat reason I cant receive this data in Request.newMeRequest, because its onCompleted method never been called. I see in logcat only Logged in/out messages. What I'm doing wrong?
Here is my code:
private Session.StatusCallback statusCallback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
onSessionStateChange(session, state, exception);
}
};
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i("QWE", "Logged in...");
Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
Log.i("QWE","onCompleted");
if (user != null) {
Log.i("QWE", "User is "+ user.getUsername());
}
}
});
} else if (state.isClosed()) {
Log.i("QWE", "Logged out...");
}
}
The problem here is that you've created a request, but you're not calling executeAsync on it, so the request is never made. Try:
Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
Log.i("QWE","onCompleted");
if (user != null) {
Log.i("QWE", "User is "+ user.getUsername());
}
}
}).executeAsync(); // <--- CHANGE IS HERE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With