1

このコードでは、GraphUser はメール ID と連絡先番号を返しません。

 @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        uiHelper.onSaveInstanceState(outState);
    }

    private void onSessionStateChange(Session session, SessionState state, Exception exception) {
        if (state.isOpened()) {
            // userInfoTextView.setVisibility(View.VISIBLE);

                // Request user data and show the results
                Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {

                    @Override
                    public void onCompleted(GraphUser user, Response response) {
                        if (user != null) {
                            // Display the parsed user info

                        String email=   (String) response.getGraphObject().getProperty("email");

                            System.out.println("yahooooooooooo  "+email);
                            buildUserInfoDisplay(user);
                        }
                    }
                });
        } else if (state.isClosed()) {
            Log.i(TAG, "Logged out...");
        }
    }

    private String buildUserInfoDisplay(GraphUser user) {
        StringBuilder userInfo = new StringBuilder("");



        // Example: typed access (name)
        // - no special permissions required
        userInfo.append(String.format("Name: %s\n\n", 
            user.getName()));

        // Example: typed access (birthday)
        // - requires user_birthday permission
        userInfo.append(String.format("Birthday: %s\n\n", 
            user.getBirthday()));


        userInfo.append(String.format("Birthday: %s\n\n", 
                user.getBirthday()));


        userInfo.append(String.format("Gender: %s\n\n", 
                user.getProperty("gender")));

        userInfo.append(String.format("Iddddddd: %s\n\n", 
                user.getId()));
        // Example: partially typed access, to location field,
        // name key (location)
        // - requires user_location permission
        userInfo.append(String.format("Location: %s\n\n", 
            user.getLocation().getProperty("name")));

        // Example: access via property name (locale)
        // - no special permissions required
        userInfo.append(String.format("Locale: %s\n\n", 
            user.getProperty("locale")));
        return userInfo.toString();
    }
4

2 に答える 2

1

すべてのアクセス許可を渡しているにもかかわらず、「メールの値がありません」というエラーが発生するという別の状況が発生しました。この背後にある理由は、その Facebook アカウントで確認されたプライマリ メールがなかったためです (Facebook でプライマリ メールを確認するには、[アカウント設定] --> [メール] に移動します)。そのため、Facebook アカウントのプライマリ メールが確認されていない場合は、常にこのエラーが発生します。アクセスしている Facebook アカウントに、確認済みのメインのメール アドレスが 1 つあることを確認してください。

于 2013-10-26T06:35:32.463 に答える