Dev01
Dev01

Reputation: 14169

Cordova/Phonegap Facebook Plugin Example/Best Practices

I'm building an app for iOS using Cordova and would like to integrate some facebook graph api functionality. Although I have the login working, I'm having trouble getting the api() function to return data. I'm currently trying to get a users friends list but an example of any workflow would be helpful.

Here's what I have so far, do I need to call the init function? It's not available under the facebookConnectPlugin object which makes me think I don't need it but maybe I need to use CDV.FB.init() or FB.init()?

var fbLoginSuccess = function (userData) {
    facebookConnectPlugin.api('/me/friends?fields=picture,name', ["basic_info", "user_friends"],
        function (result) {
            alert("Result: " + JSON.stringify(result));
        }, 
        function (error) { 
            alert("Failed: " + error);
        }
    );

}

facebookConnectPlugin.login(
    ["basic_info"], 
    fbLoginSuccess, 
    function (error) { 
        alert("" + error);
    }
);

Upvotes: 0

Views: 3584

Answers (1)

Sean Kinsey
Sean Kinsey

Reputation: 38046

With Graph v2.0, only friends using the same app will be visible to the app.

Upvotes: 2

Related Questions