简体   繁体   中英

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(); 
    }

确保您添加此权限

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM