Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have tried to use the facebook sdk in libgdx with callbacks, but it never enters the authetication listeners, so the user never is logged in, it permits the authorization for the facebook app but it never implements the authentication interfaces :(

Is there a way to use it?

public MyFbClass()
{
    facebook = new Facebook(APPID);
    mAsyncRunner = new AsyncFacebookRunner(facebook);
    SessionStore.restore(facebook, this);

    FB.init(this, 0, facebook, this.permissions);
}


///Method for init the permissions and my listener for authetication
public void init(final Activity activity, final Facebook fb,final String[] permissions) 
    {
        mActivity = activity;
            this.fb = fb;
        mPermissions = permissions;
        mHandler = new Handler();
        async = new AsyncFacebookRunner(mFb);

        params = new Bundle();

        SessionEvents.addAuthListener(auth);

    }

///I call the authetication process, I call it with a callback from libgdx
public void facebookAction() 
    {
        // TODO Auto-generated method stub
        fb.authenticate();
    }

///It only allow the app permission, it doesnt register the events
public void authenticate()
    {
        if (mFb.isSessionValid()) 
        {
            SessionEvents.onLogoutBegin();
            AsyncFacebookRunner asyncRunner = new AsyncFacebookRunner(mFb);
            asyncRunner.logout(getContext(), new LogoutRequestListener());
            //SessionStore.save(this.mFb, getContext());
        } 
        else
        {
            mFb.authorize(mActivity, mPermissions,0 , new DialogListener());

        }
    }

public class SessionListener implements AuthListener, LogoutListener
    {

        @Override
        public void onAuthSucceed() 
        {
            SessionStore.save(mFb, getContext());
        }

        @Override
        public void onAuthFail(String error) {
        }

        @Override
        public void onLogoutBegin() {
        }

        @Override
        public void onLogoutFinish() {
            SessionStore.clear(getContext());
        }
    }

DialogListener() {

            @Override
            public void onComplete(Bundle values) 
            {
                SessionEvents.onLoginSuccess();
            }

            @Override
            public void onFacebookError(FacebookError error) 
            {
                SessionEvents.onLoginError(error.getMessage());
            }

            @Override
            public void onError(DialogError error) 
            {
                SessionEvents.onLoginError(error.getMessage());
            }

            @Override
            public void onCancel() 
            {
                SessionEvents.onLoginError("Action Canceled");
            }
}
share|improve this question
    
Can you show what you have tried already? –  Rubber Mallet Apr 20 '12 at 4:31
    
To answer the question in the title: Yes, there is. decisiontreegames.wordpress.com/2012/04/01/… he also has another guide about doing non-libgdx calls –  Matsemann Apr 25 '12 at 9:23
    
did you manage to integrate facebook in libgdx? Can you post a link or a mini project? –  Lunatikul Mar 13 '13 at 9:13
    
Yes I could do it, I did it with the example above, but I forgot to add onActivityResult in the activity thas uses the facebook callback. If you are having problems tell me :) –  Rudy_TM Mar 13 '13 at 17:48
add comment

1 Answer 1

It might not be you. Facebook connect was down worldwide for a couple hours around the time of your post. See http://news.ycombinator.com/item?id=3866353 (or http://developers.facebook.com/bugs/367587563282522)

share|improve this answer
    
No, because in normal example without libgdx i could aunthenticate and post, with libgdx i cannot do any of them, only allow the app u.u –  Rudy_TM Apr 20 '12 at 7:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.