0

androidfacebooksdkを使用してウォールポストで友達にタグを付けようとしています。ただし、タグとなるはずのものは空白で、何もありません。これは私が使用したコードです:

            Bundle params = new Bundle();
            access_token = fb.getAccessToken();

            try {
                params.putString("format", "json");
                params.putString("access_token", access_token);
                String url = "https://graphs.facebook.com/me/friends";
                String response = Util.openUrl(url, "GET", params);
                JSONObject json = Util.parseJson(response);
                JSONArray array = json.optJSONArray("data");

                for(int i = 0; i < array.length(); i++) {
                    String tempName = array.getJSONObject(i).getString("name");
                    String tempID = array.getJSONObject(i).getString("id");

                    //Probably should have some if-tests here

                    if(tempName.contains(*nameOfFriend*)) {
                        Bundle bundle = new Bundle();
                        bundle.putString("message", "App tagging test");
                        //this is where the tagging is supposed to happen
                        bundle.putString("tags", *UserID*);
                        try {
                            fb.request("me/feed", bundle, "POST");
                            Toast.makeText(getApplicationContext(), "Tag-test", Toast.LENGTH_SHORT).show();
                        } catch (MalformedURLException e) {
                            Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT).show();
                            e.printStackTrace();
                        } catch (IOException e) {
                            Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT).show();
                            e.printStackTrace();
                        }
                    } else {
                        Toast.makeText(getApplicationContext(), "Couldn't find friend", Toast.LENGTH_SHORT).show();
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

「publish_stream」のアクセス許可のみを付与しましたが、他のアクセス許可が必要な場合がありますか?助けてくれてありがとう、みんな!

4

2 に答える 2

0

placeあなたのコードには値が表示されませんが、API を介して作成された投稿で人にタグを付けるときに必要です。

https://developers.facebook.com/docs/reference/api/user/#posts :

タグ […] 注: 場所を指定せずにこのフィールドを指定することはできません。

于 2012-07-17T12:52:08.183 に答える