How to tag friends in a wall post using facebbok sdk in android?

拟墨画扇 提交于 2019-12-11 06:22:28

问题


I am trying to tag one friend in my wall post. But this 'tags' parameter isn't working. How can i tag one/more friends? Pls help me. Thank you in advance.

            Bundle params = new Bundle();

            params.putString("tags", tagged_friends_id);

             WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(this, 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(MainActivity.this,"Posted story, id: "+postId, Toast.LENGTH_SHORT).show();
                                } 
                                else {
                                    // User clicked the Cancel button
                                    Toast.makeText(MainActivity.this,  "Publish cancelled", Toast.LENGTH_SHORT).show();
                                }
                            } 
                            else if (error instanceof FacebookOperationCanceledException) {
                                // User clicked the "x" button
                                Toast.makeText(MainActivity.this,  "Publish cancelled", Toast.LENGTH_SHORT).show();
                            } 
                            else {
                                // Generic, ex: network error
                                Toast.makeText(MainActivity.this, "Error posting story", Toast.LENGTH_SHORT).show();
                            }
                        }

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

回答1:


As Ming have mentioned, you can not tag friends using the Feed Dialog.

The only way to tag friends in a post, is using the Open Graph Concept- Mention Tagging




回答2:


You can tag multiple friends using the "tags" key itself. But the syntax needs to be bit different. The friend ids must be appended in a string separated by comma. There should not be any spaces between the ids.

For eg:

params.putString("tags", "xxxxx1,xxxxx2");

This worked perfectly for me.




回答3:


See the documentation for the supported parameters to the Feed dialog here:

https://developers.facebook.com/docs/reference/dialogs/feed/

The Feed dialog does not support "tags".



来源:https://stackoverflow.com/questions/19144959/how-to-tag-friends-in-a-wall-post-using-facebbok-sdk-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!