问题描述
我想使用 Facebook Android SDK 发送好友请求.我目前正在使用此代码(我从 此处 获得):
I want tot send a friend request using the Facebook Android SDK. I'm currently using this code (which I got from here):
Bundle parameters = new Bundle();
parameters.putString("APP_ID","USERNAME");
facebook.dialog(this, "friends", parameters, this);
其中 APP_ID 是我的应用程序的 Facebook ID,USERNAME 是我要添加的朋友的用户名.这会导致以下错误:
where APP_ID is the Facebook ID of my app and USERNAME is the username of the friend I want to add. This leads to the following error:
API Error Code:100
Invalid parameter
The parameter id is required
我认为 id 参数是指 APP_ID.
I thought the id parameter meant the APP_ID.
我在 http://developers 浏览了有关对话框的相关文档.facebook.com/docs/reference/dialogs/friends/ 和 http://developers.facebook.com/docs/reference/androidsdk/dialog/,但还是想不通.
I have gone through the relevant documentation regarding dialogs at http://developers.facebook.com/docs/reference/dialogs/friends/ and http://developers.facebook.com/docs/reference/androidsdk/dialog/, but still can't figure it out.
感谢任何帮助.
推荐答案
应该是这样的:
Bundle parameters = new Bundle();
parameters.putString("id", USER_ID);
facebook.dialog(this, "friends", parameters, this);
如果 this
是一个也实现了 DialogListener
的活动.
In case that this
is an activity which also implements DialogListener
.
正如文档中所说:
app_id - 您的应用程序标识符.需要,但自动由大多数 SDK 指定.
id - 必需.的 ID 或用户名目标用户添加为朋友.
这篇关于如何在 Android 上使用 Facebook 对话框发送好友请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!