如何在Android上发送使用Facebook对话的朋友请求? [英] How to send friend request using Facebook dialogs on Android?

查看:114
本文介绍了如何在Android上发送使用Facebook对话的朋友请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要使​​用Facebook Android SDK发送一个朋友请求。我正在使用这个代码(我从 here 获得) :

  Bundle parameters = new Bundle(); 
parameters.putString(APP_ID,USERNAME);
facebook.dialog(这个,朋友,参数,这个);

其中APP_ID是我的应用的Facebook ID,USERNAME是我要添加的朋友的用户名。这将导致以下错误:

  API错误代码:100 
参数无效
参数ID为需要

我以为id参数意味着APP_ID。



我已经通过 http://开发人员的相关文档.facebook.com / docs / reference / dialogs / friends / http ://developers.facebook.com/docs/reference/androidsdk/dialog/ ,但仍然无法弄清楚。



任何帮助不胜感激

解决方案

应该是这样的:

 code> Bundle parameters = new Bundle(); 
parameters.putString(id,USER_ID);
facebook.dialog(这个,朋友,参数,这个);

如果这个是一个活动还实现 DialogListener



正如文档中所述:


app_id - 您的应用程序的标识符。必需,但自动
由大多数SDK指定。

id - 必需。
目标用户的ID或用户名作为朋友添加。



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);

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

I thought the id parameter meant the APP_ID.

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.

Any help is appreciated.

解决方案

Should be something like:

Bundle parameters = new Bundle();
parameters.putString("id", USER_ID);
facebook.dialog(this, "friends", parameters, this);

In case that this is an activity which also implements DialogListener.

As it says in the documentation:

app_id - Your application's identifier. Required, but automatically specified by most SDKs.
id - Required. The ID or username of the target user to add as a friend.

这篇关于如何在Android上发送使用Facebook对话的朋友请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆