There is a way to do it, but it's not as straightforward as a simple API call and there's not (currently) a Spring Social operation to support it directly. However...
The Facebook Graph API endpoint you want is /me/friends, which is the same endpoint that FriendOperations.getFriends() uses. But you have to ask that endpoint to return the "installed" field to know whether or not they are a user of the application (that is, whether or not they are users of the application who is asking for the list of friends--I do not think you can ask which friends are users of another application).
To do that, the proper endpoint request should look like:
https://graph.facebook.com/me/friend...name,installed
Although there's not an API binding method in Spring Social that supports this directly, you can still do it via the fetchConnections() method on Facebook (actually, it's on the GraphApi interface, which Facebook extends):
Code:
Facebook fb = usersConnectionRepository.createConnectionReposito ry(searcher.getId()).getPrimaryConnection(Facebook .class).getApi();
List<MyFriend> myFriends = fb.fetchConnections("me", "friends", MyFriend.class, "name", "installed");
Note that the MyFriend class isn't part of Spring Social. You'll need to create that yourself--possibly by simply extending Reference and adding a boolean installed property. Then you'll need to cycle through the list of MyFriend you get and look for the ones where installed == true. Those are the friends who have the app installed.
This sounds like a nice addition to Spring Social's Facebook API binding. That is, it would be nice if Spring Social Facebook had an API binding method that would just return a list of friends who have the same app installed so that you wouldn't have to sift through the list yourself. Would you mind creating an issue for the API binding to support it directly at
https://jira.springsource.org/browse/SOCIALFB ?