如何使用Facebook API使用FQL获取在线朋友列表? [英] How to get list of online friends using FQL with facebook API?
问题描述
在Facebook上使用Facebook连接Java脚本客户端API登录后,我已经得到了我的朋友列表。我想在给定时间在线的朋友列表。
I have got my friends list after getting logging in on facebook using Facebook connect Java script client API. I want list of my friends that are online at given time.
推荐答案
您可以使用 online_presence
用户表中的/ code>列,这表示用户当前的Facebook聊天状态。这不是一个万无一失的现在这个用户在线,但它确实有一般目的。此列是一个字符串,其中包含四个可能的值之一:活动
, idle
, offline
或错误
。查询朋友
表与此结果可以产生您请求的结果(在这种情况下,我认为在线是指活动
或 idle
):
You can use the online_presence
column of the user
table, which gives the user's current Facebook Chat status. This isn't a foolproof "is this user online right now" but it does serve the general purpose as such. This column is a string which has one of four possible values: active
, idle
, offline
, or error
. Querying the friend
table in conjunction with this can yield the result you requested (in this case I consider "online" to mean active
or idle
):
SELECT uid FROM user WHERE
online_presence IN ('active', 'idle')
AND uid IN (
SELECT uid2 FROM friend WHERE uid1 = $user_id
)
更新:
请注意,您需要 user_status
读取用户状态的权限和 user_online_presence
和/或 friends_online_presence
权限对于 online_presence
。
Note that you need the user_status
permission to read the user's status and user_online_presence
and/or friends_online_presence
permissions for the online_presence
.
感谢https://stackoverflow.com/users/613631/laphroaig 将其带入( Facebook的在线好友),而 https://stackoverflow.com/users/570958/roozbeh15 的答案。
Thanks to https://stackoverflow.com/users/613631/laphroaig for bringing this up (Facebook online friend), and to https://stackoverflow.com/users/570958/roozbeh15 for his answer.
这篇关于如何使用Facebook API使用FQL获取在线朋友列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!