Facebook API provides a boolean field that can help you filter the User's friends with your application Installed. You need to Make a request for User's Friends List and set the required fields to include the "installed" boolean. The following code snippet may help you out.
private void requestMyAppFacebookFriendsWithAppInstalled(Session session) {
Request friendsRequest = createRequest(session);
friendsRequest.setCallback(new Request.Callback()
{
@Override
public void onCompleted(Response response)
{
//SetUpList
List<GraphUser> friends = getResults(response);
GraphUser user;
friendsList=new ArrayList<ACT_friendsListPicker.FB_FriendsListStructure>();
boolean installed = false;
if(friends!=null)
{
for(int count=0;count<friends.size();count++)
{
user = friends.get(count);
if(user.getProperty("installed") != null)
{
installed = (Boolean) user.getProperty("installed");
Log.i("frndsPickerAppInstalled? YES ","user: "+user.getInnerJSONObject());
}
}}}});
private Request createRequest(Session session) {
Request request = Request.newGraphPathRequest(session, "me/friends", null);
Set<String> fields = new HashSet<String>();
String[] requiredFields = new String[] { "id", "name", "picture","hometown",
"installed" };
fields.addAll(Arrays.asList(requiredFields));
Bundle parameters = request.getParameters();
parameters.putString("fields", TextUtils.join(",", fields));
request.setParameters(parameters);
return request;
}
private class FB_FriendsListStructure
{
String Name,ID,ImageUrl;
boolean selected;
}
private List<GraphUser> getResults(Response response) throws NullPointerException
{
try{
GraphMultiResult multiResult = response
.getGraphObjectAs(GraphMultiResult.class);
GraphObjectList<GraphObject> data = multiResult.getData();
return data.castToListOf(GraphUser.class);
}
catch(NullPointerException e)
{
return null;
//at times the flow enters this catch block. I could not figure out the reason for this.
}
}