获取Facebook数据安卓

时间:2015-05-19 15:32:56

标签: java javascript android facebook facebook-graph-api

我试图获取用户的ID和用户的全名,并且如果可能的话,还有Facebook个人资料图片并将其存储在内存中以便在任何我想要的地方使用,这是我试过的:

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {


        position = getArguments().getInt(ARG_POSITION);
        View rootView = inflater.inflate(page, container, false);
        FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fabButton);
        final ProgressBarCircular progressBarCircular = (ProgressBarCircular) rootView.findViewById(R.id.progress);

        Log.i("ADebugTag", "Value: ");


            public void onSuccess(LoginResult loginResult) {
                GraphRequest request = GraphRequest.newMeRequest(
                        loginResult.getAccessToken(),
                        new GraphRequest.GraphJSONObjectCallback() {
                            @Override
                            public void onCompleted(
                                    JSONObject object,
                                    GraphResponse response) {

                                Profile profile = Profile.getCurrentProfile();
                                String firstName = profile.getFirstName();
                                String a = "a";

                                Log.i("ADebugTag", "Value: " + firstName);

                            }
                        });

                Bundle parameters = new Bundle();
                parameters.putString("fields", "id,name,email");
                request.setParameters(parameters);
                request.executeAsync();

            }

            @Override
            public void onCancel() {
                Log.i("ADebugTag", "BANANA ");
            }

            @Override
            public void onError(FacebookException exception) {
                Log.i("ADebugTag", "BOOH ");
            }
        });



    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        CallbackManager callbackManager = CallbackManager.Factory.create();
        callbackManager.onActivityResult(requestCode, resultCode, data);
    }

但"价值"在logcat中是空的..

UP

0 个答案:

没有答案