I am trying to fetch following case using FQL
If few users have authorized "Application A" then is it possible to know that currently how many users are using that "Application A" ( users those are not friends of each other)
So far i tried following FQL , but following query gives only information of those users who are
friends of each other and using the same application , but what about other users who are not friends ?
SELECT uid, name, pic_square
FROM user
WHERE is_app_user=1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
You can't get a listing of your application's users from the API. If you need this, you should maintain your own database of users and reference that.
You can also check if any particular user is a user of your application by requesting /USER_ID/permissions?fields=installed
with your application access token.
You can also check if a user's friends are users of your application by requesting the same field on the friends connection (for example, /USER_ID/friends?fields=installed
). In this case, the USER_ID must be a user of your application or you won't be able to access their friends list.
is_app_user on the user table when requesting friends returns this data.
SELECT uid,is_app_user FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
or...
SELECT uid,is_app_user FROM user WHERE is_app_user AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
Which is a bit tighter - only returning those users in-app.
You can't get total number of users who have installed application, but you can get daily, weekly and monthly users with simple query:
SELECT daily_active_users, weekly_active_users, monthly_active_users
FROM application WHERE app_id = APPLICATION_ID
Note: this will work for any application (not just applications user connected to)
SELECT uid FROM user WHERE uid IN ( SELECT uid2 FROM friend
WHERE uid1 = '549483876' ) AND is_app_user = 1