how to know which of a user's fb friends have liked a given url?

I'm writing an android app which has fb login.

I give the user a list of urls and allow him to do a "facebook like"

to the urls he liked.

how can I show the user his friends (or at least a partial list) who

liked every url, and by than motivate him to do a fb like as well?

I'm using facebook SDK of course.

Answers


You can use FQL to get a list of the URL likes of the User's friends via the url_like table:

SELECT user_id, url FROM url_like WHERE user_id IN (SELECT uid2 FROM friend WHERE uid1 = me() limit 0,25) limit 0,999

I added a limit to both the friends subquery and the main query for the URL likes. Depending on the number of friends a User has and the number of URL likes each friends has performed, the query can get quite heavy. I'd recommend to do this server side (if you have some kind of infrastructure), and that you do an aggregation (count of friends which liked a specific URL) to be able to show a more meaningful result.


Need Your Help

SCRIPT601: Unknown runtime error , SCRIPT438: Object doesn't support property or method 'extend'

jquery ajax internet-explorer freemarker

I am working with servlets with freemarker templates, I am using jQuery for AJAX calls, here is my code:

JSON_PRETTY_PRINT not working as expected when Content-Type is HTML

php mysql sql json

I'm receiving a JSON string dynamically, which looks like: