我在我的Android应用程序集成了Facebook。在应用程序中,我想获取发送给我的应用程序的好友请求列表,我的代码在java.I中花费了很多时间在搜索提前显示好友请求列表
Q
显示好友请求列表
-1
A
回答
1
String uri ="https://graph.facebook.com/me/friendrequests";
HttpGet get = new HttpGet(uri);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
if (resEntityGet != null) {
Log.i("GET ",EntityUtils.toString(resEntityGet));
}
} catch (Exception e) {
e.printStackTrace();
}
将返回某些信息,如from
,to
,created_time
等 这里的更多信息https://developers.facebook.com/docs/reference/api/user/#friendrequests
编辑它还说,它作为一个“对象数组”所以我asssuming了一个JSON格式。按照以下方式使用JSONTokener
和JSONObject
进行解析。插入此行后HttpResponse response = client.execute(get);
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8"));
StringBuilder builder=new StringBuilder();
for(String line=null;(line = reader.readLine()) != null;){
builder.append(line).append("\n");
}
JSONTokener jsonTokener=new JSONTokener(builder.toString());
JSONObject finalJson=new JSONObject(jsonTokener)
0
一个solution.thanks也许THIS将帮助您
例子
发送到当前会话的用户所有未决的朋友请求(试试这个 查询)
SELECT uid_from,时间,消息FROM friend_request WHERE uid_to =我()
由当前会话的用户发送到另一个 用户
SELECT时间挂起的朋友请求,消息FROM friend_request WHERE uid_from =我()和 uid_to = “204686”
相关问题
- 1. Facebook好友请求
- 2. 显示所有好友列表
- 3. 列出所有的Facebook好友请求
- 4. 友好的URL用GET请求表单
- 5. 如何根据好友请求的状态使用MySQL获取好友列表?
- 6. 删除好友请求?
- 7. drupal facebook好友请求
- 8. 如何让Facebook好友请求框在canvas页面中显示?
- 9. Facebook SDK好友请求重定向?
- 10. Facebook图api好友请求发送
- 11. Facebook应用程序在jsp中显示好友列表
- 12. 用户好友在Facebook上显示空列表Sdk Graph Api v2
- 13. 正在检索Facebook的好友列表并在Tableview中显示
- 14. 如何在首页显示好友列表,使用php my sql?
- 15. 在django中显示json文本作为友好列表管理
- 16. 显示友好的错误消息时有一些Ajax请求后错的jqGrid
- 17. Rails 3友情模型:如何忽略好友请求?
- 18. 获取Facebook好友列表
- 19. FBFriendPickerViewController好友列表为空
- 20. 机器人如何显示我的Facebook好友,并邀请玩
- 21. 如何获取好友列表使用新的请求邀请在Facebook应用程序与要求2.0
- 22. 从Facebook好友谁接受了我的邀请请求
- 23. Rails:如何显示所有待处理的朋友请求?
- 24. Rails:在视图中显示待处理的朋友请求
- 25. 序列图 - 友谊请求FCM
- 26. 试图访问Facebook好友列表,但得到一个空的好友列表
- 27. 将Facebook好友加入FB.api的好友列表
- 28. 找到没有在任何好友列表中的Facebook好友
- 29. 显示友好的日期,数字
- 30. 向用户显示友好的消息