Search code examples
androidfacebook-android-sdkfacebook-sdk-3.0

facebook android sdk, newMeRequest never returns


I'm trying to follow scrumptious tutorial, at the part of newMeRequest, the request never returns, the code is as in the example, like below. Am I missing anything? thanks?

private void makeMeRequest(final Session session) {
        // Make an API call to get user data and define a
        // new callback to handle the response.
        Request request = Request.newMeRequest(session,
                new Request.GraphUserCallback() {
                    @Override
                    public void onCompleted(GraphUser user, Response response) {
                        // If the response is successful
                        if (BuildConfig.DEBUG){
                            Log.i(TAG, "GraphUserCallback" + user.getId()+" " + response.toString());

                        }
                        if (session == Session.getActiveSession()) {
                            if (user != null) {
                                // Set the id for the ProfilePictureView
                                // view that in turn displays the profile picture.
                                //profilePictureView.setProfileId(user.getId());
                                profilePictureView.setId(Integer.parseInt(user.getId()));
                                // Set the Textview's text to the user's name.
                                userNameView.setText(user.getName());
                            }
                        }
                        if (response.getError() != null) {
                            // Handle errors, will do so later.
                        }
                    }
                });
        request.executeAsync(); 
    }

Solution

  • Make sure you add this permission

    <uses-permission android:name="android.permission.INTERNET"/>