0

I am trying to get facebook friends through Facebook Graph API on my Ionic Application. The plugin https://github.com/Wizcorp/phonegap-facebook-plugin was used. When I use friend api, it only returns 12 friends. But in truth, there are more than 3000 friends. How can I get all friends? Here is the code.

    function getFBFriends(eCallbackFunc)
    {
        facebookConnectPlugin.api('/me/friends?fields=uid', [],
            function(response)
            {
                console.log(response);
                eCallbackFunc(response, null);
            },
            function(response)
            {
                eCallbackFunc(response, 'error');
            }
        );
    }

And the JSON response data is following as below: enter image description here

How can I get all Facebook friends?

Michael Lee
  • 135
  • 1
  • 11

2 Answers2

1

You can only get friends who authorized your App too (with the user_friends permission). 12 friends authorized your App.

More information: Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app

Community
  • 1
  • 1
andyrandy
  • 72,880
  • 8
  • 113
  • 130
0

Well, it's supposed to work with facebookConnectPlugin.api but they are facing some stability issues. You can follow up here:

https://github.com/phonegap/phonegap-facebook-plugin/issues/468

Anyway, I downloaded the version from the dev branch and it works as expected.

Naitik
  • 1,455
  • 15
  • 26