在Facebook上发布状态并标记朋友

时间:2014-03-05 07:14:04

标签: android facebook

我正在尝试在用户自己的墙上发布状态并在其上标记好友。 我尝试过FeedDialogBu​​ilder,但我不能用它来标记朋友。如果有人知道怎么做,请帮助我。

Bundle params = new Bundle();

    params.putString("tags","8768XXX787,"1111XXXX222,"565XXX566565");

    WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(getActivity(), Session.getActiveSession(),params))
            .setOnCompleteListener(new OnCompleteListener() {

                @Override
                public void onComplete(Bundle values, FacebookException error) {
                    if (error == null) {
                        final String postId = values.getString("post_id");
                        if (postId != null) 
                        {
                            Toast.makeText(getActivity(),"Posted story, id: "+postId, Toast.LENGTH_SHORT).show();
                        } 
                        else {
                            // User clicked the Cancel button
                            Toast.makeText(getActivity(),  "Publish cancelled", Toast.LENGTH_SHORT).show();
                        }
                    } 
                    else if (error instanceof FacebookOperationCanceledException) {
                        // User clicked the "x" button
                        Toast.makeText(getActivity(),  "Publish cancelled", Toast.LENGTH_SHORT).show();
                    } 
                    else {
                        // Generic, ex: network error
                        Toast.makeText(getActivity(), "Error posting story", Toast.LENGTH_SHORT).show();
                    }
                }

            }).build();
    feedDialog.show();

0 个答案:

没有答案