Software Archive
Read-only legacy content
17060 Diskussionen

Facebook Connect Plugin

Alexander_F_
Anfänger
5.189Aufrufe

Hey can some body help me with this, I try to get email and public profile from facebook app, I included the plugin cordova facebook connect and enter my App ID and App Name, but when nothing happens when I execute this function, do not show nothing, thank you in advance.

function facebook_login(){
    //get login status
    facebookConnectPlugin.getLoginStatus(fbLoginSuccess, 
        function (error){
            alert("" + error);
        }
    );
    var fbLoginSuccess = function(data){
        alert(data);
        if(data.status == 'connected'){
            //get info
            facebookConnectPlugin.api(data.userID + "/?fields=email", ["public_profile"],
                function(result){
                    var form = document.getElementById('registerform');
                    form.email.value = data.email;
window.localStorage.setItem('fb_first_name', result.first_name);
                            window.localStorage.setItem('fb_last_name', result.last_name);
                            //load create_account_page
                            $.mobile.changePage('#create_account', {transition: 'flip'} );
                    },
                        function(error){
                            alert('Failed ' + error);
                    }
            );
        }else{
            alert(data);
            facebookConnectPlugin.login(["email", "public_profile"],
                fbLoginSuccess,
                function (error) { alert("" + error) }
            );
        }
    }
}

 

0 Kudos
9 Antworten
Alexander_F_
Anfänger
5.189Aufrufe

Check this screens, when I try to login on facebook, and here is the new code, please help ASAP.

 

function facebook_login(){
    var fbLoginSuccess = function (userData) {
        alert("UserInfo: " + JSON.stringify(userData));
        //get info
        facebookConnectPlugin.api("me/?fields=id,email", ["public_profile"],
            function (result) {
                alert("Result: " + JSON.stringify(result));
            },
            function (error) {
                alert("Failed: " + error);
            }
        );
    }

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

Thank You!

 

Elroy_A_Intel
Mitarbeiter
5.189Aufrufe

You are required to provide a hashkey in your Facebook application. For more information about the creation of key hashes, visit the following links as a startingpoint:

David_B_12
Einsteiger
5.189Aufrufe

I'm just getting this error in the chrome log when debuggon on a physical device and using AppPreview:

Uncaught ReferenceError: facebookConnectPlugin is not defined 

David_B_12
Einsteiger
5.189Aufrufe

So the facebook plugin only works when you do a full build and deploy to a phone.  It doesn't work when you use the Debug tab.  So the question is how are you supposed to use the debugger when you've got FB integrated as it seems to be be rather useless now?. :\

John_H_Intel2
Mitarbeiter
5.189Aufrufe

Yes, you must build your app to use the fb plugin. 

David_B_22
Einsteiger
5.189Aufrufe

JOHN H. (Intel) wrote:

Yes, you must build your app to use the fb plugin. 

 

 

So the app is built as crosswalk for android but I'm seeing the Invalid facebook keys error still.  Where do I set/get the key?

Amrita_C_Intel
Mitarbeiter
5.189Aufrufe

Can you provide some screenshots? You can refer to this article as well.

https://software.intel.com/en-us/xdk/article/facebook-connect-plugin-android-ios

David_B_22
Einsteiger
5.189Aufrufe

Hi Amrita.  I tried again this morning and it worked.  I created a new test facebook app on developers.facebook.com but this time I didn't add the android platform to the app as I did in the previous one.  I guess that's what might have caused the issue.

Thanks again.

David_B_22
Einsteiger
5.189Aufrufe

I think there is still an issue here. Here's what happens.  

1.  Build android app and deploy to device.

2.  FB connect works, my app is connected to the user.

3.  I make another build (same FB_APP_ID etc.), remove the first original build from the phone and redeploy.

4. FB connect plugin has a login status of 'unknown' as opposed to 'connected' before.  The FB window is also now shown with "This app has no Android key hashes configured. Configure your app key hashes at...".

So how do users receive updated versions of the app without removing it from their facebook settings first?  I don't understand.

 

Antworten