Software Archive
Read-only legacy content
17061 Discussions

Facebook 3rd party plug-in walkthrough

Hooman_F_
Beginner
279 Views

I am new to the XDK platform.  I am trying to use the Facebook Connect plugin listed under the Featured plug-ins of the project.  I have checked the box and provided my App ID and Name.  The Wizcorp site the plug-in refers to (https://github.com/Wizcorp/phonegap-facebook-plugin/) shows the javascript calls to make to login, example:

var fbLoginSuccess = function (userData) {
    alert("UserInfo: " + JSON.stringify(userData));
}

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

I have a button in my app that I click to invoke the login function above, but nothing happens.  Can someone provide some step-by-step instructions on how to use this plug-in?

 

0 Kudos
3 Replies
PaulF_IntelCorp
Employee
279 Views
0 Kudos
Amrita_C_Intel
Employee
279 Views

Hi,

When I executed above specified link sample, the app was running.So below is the part of that sample code for Login.

var login = function () {
                if (window.cordova.platformId == "browser") {
                    var appId = "your app ID"// Specify your App id here
                    facebookConnectPlugin.browserInit(appId);
                    alert(JSON.stringify(facebookConnectPlugin))
                }
                facebookConnectPlugin.login( ["email"], 
                    function (response) { alert(JSON.stringify(response)) },// Success Message
                    function (response) { alert(JSON.stringify(response)) });// Failure Message
            }

I believe that you need to specify your app Id if it is not updating in index.html.

0 Kudos
Hooman_F_1
Beginner
279 Views

I think my issue (which doesn't seem very well documented IMHO) is that I was trying this in the emulator.  Now, the documents do mention that only "core" plugins work in the emulator tab (for the time being - build 1826).  However, the Facebook Connect plugin is not listed under the 3rd party plugins.  It's listed as "featured." And  the nomenclature "core" is not seen in the project properties pages. For future (noobie) users might be good to sync up the terminology.  If the "core" label is used in docs, then the project properties should say "core" as well.  This "featured" section is really 3rd party (Intel validated?). 

Anyhow, once I built the app (under IOS in my case), and downloaded the app to my phone, the code worked as shown and I was redirected to the FB login page.

0 Kudos
Reply