3

ive tryed some solution found here to get a list of my friend online:

Facebook FQL query to get all users online

How to get list of online friends using FQL with facebook API?

this is my fql query:

$fql = "SELECT uid, name, online_presence, status FROM user WHERE uid IN 
( SELECT uid2 FROM friend WHERE uid1 = '".$me['id']."')";

But the presence field is empty for 99% of my friends. I get the presence (active, idle, offline), only for 6/7 friends. the same for the status field.

How i can get the complete presence and status data? What i'm missing? I need to request a particular permission for my app (currently i have only the basic).

Thank you very much.

EDIT: The @Roozbeh15 solution is the answer, but i need to fid why the result isn't the same number of user i hvae in chat. The fql user count is always < than the user in fb chat. Do you know why?

Community
  • 1
  • 1
Laphroaig
  • 619
  • 4
  • 12
  • 26

1 Answers1

8

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.

Here is the full permissions list.

Roozbeh15
  • 4,047
  • 6
  • 27
  • 30
  • Thank you this solved the problem! But the total online users that i get from this query isn't the same as the users i really have on the chat. Do you know why? – Laphroaig Apr 14 '11 at 21:22
  • Not sure, but there is a lot of inconsistency in Facebook's data. i.e. The number of likes that you get from link_stats table is usually different from the number of likes that you actually see on a URL. – Roozbeh15 Apr 15 '11 at 19:30
  • 1
    Also, I think your friends can edit your settings so that applications don't see their information such as their online presence... Another reason might be because of the distributed systems that facebook uses. It takes some time to sync all machines. In any case, I don't think you can do anything about this as a developer. Good luck. – Roozbeh15 Apr 15 '11 at 19:33
  • Yes, i was on this too. Thank you very much again. – Laphroaig Apr 17 '11 at 12:52
  • I get this error: code: 803 message: "(#803) Some of the aliases you requested do not exist: SELECT uid, name, online_presence, status FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1 = "undefined"" type: "OAuthException" – Totty.js Oct 11 '13 at 15:31
  • 1
    Permissions starting from friends_* are no longer valid. Is there a way to get online friends with new API? – Ruwanka De Silva Feb 02 '15 at 05:54