qualinost
qualinost

Reputation: 113

Request.GraphUserCallback always return a null user

I'm new on android and facebook SDK. I followed the LoginButton tutorial from facebook developers pages. Everythings worked well until I tried to get user info. I searched a solution on every forum but didn't find a solution which solved my problem. Here is my code:

private void onSessionStateChange(Session session, SessionState state, Exception exception) {
    if (state.isOpened()) {
        Log.i(TAG, "Logged in...");

        // make request to the /me API
        Request.newMeRequest(session, new Request.GraphUserCallback() {

            // callback after Graph API response with user object
            @Override
            public void onCompleted(GraphUser user, Response response) {
                if (user != null) {
                    welcome.setText("Hello " + user.getName() + "!");
                }
            }
        }).executeAsync();

    } else if (state.isClosed()) {
        Log.i(TAG, "Logged out...");
    }
}

I'm logged in, I accepted facebook permissions and I declared INTERNET permission in my manifest but my 'user' is always null.

Any ideas?

Upvotes: 1

Views: 318

Answers (1)

qualinost
qualinost

Reputation: 113

My bad... My internet permission in my manifest was a child of "application" instead of "manifest"... I saw that when I tried to buid the apk, never when I was on debug mode.

Sorry for the stupid question, maybe it can helps anyway some others newbies like me. ;)

Upvotes: 1

Related Questions