Search code examples
phpandroidfacebooknotificationsfacebook-sdk-3.0

Notify friends of a user who starts using your facebook app


I realize this is a bit vague, but I have no idea where to even begin searching for this. I know for a fact that when a user registers on "Circle" using facebook they somehow have found a way to notify all of that users facebook friends that they joined Circle or at the very least it notify all of a users friends who also registered with circle that they joined. How did they accomplish this using the Facebook SDK?

One more time to be perfectly clear: Currently when one of my friends registers with the social app "Circle" using facebook I end up getting a notification on Facebook telling me "Joe Smith joined Circle" and I would like to know how to get my app to do the same thing using the fb sdk


Solution

  • A circle is normally known as a "group", and is just implemented by three tables: a user table and a group table, plus a many:many table inbetween them. By convention this is called user_group, and usually just contains two columns - user_id and group_id. The combination of those two columns is usually defined as a primary or unique key, to ensure a user cannot join a group twice.

    Joining a group involves inserting a row into the last table, and leaving a group just requires deleting a row from the same. To delete a group entirely, you need to delete all of its memberships, and to delete a user, you need to remove them from every group they belong to.

    For this sort of work, it helps to create foreign key constraints, to enforce referential integrity.