我正在尝试使用 android facebook sdk 在wallpost 中标记一个朋友。但是,应该是标签的东西是空白的,什么都没有。这是我使用的代码:
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”的权限,难道我需要其他权限吗?提前感谢您的帮助,伙计们!