David Anderson
David Anderson

Reputation: 623

Exception when logging in with Simple Facebook API (Session: an attempt was made to open a session that has a pending request)

I'm using Simple Facebook API for Android and I'm facing a issue here.

I'm using the code from their website to login https://github.com/sromku/android-simple-facebook and fetch profile info.

It works. When I click on my "login" button it displays the Facebook Login page, then after login it goes to authorization and heads back to my app and it works.

BUT, if I click on login, then close the LoginDialog that opens with the Facebook Login Page, and attempt to login again I get this exception:

ERROR/Facebook(17472): Bad thing happened java.lang.UnsupportedOperationException: Session: an attempt was made to open a session that has a pending request. at com.facebook.Session.open(Session.java:958) at com.facebook.Session.openForRead(Session.java:388) at com.sromku.simple.fb.SimpleFacebook.openSession(SimpleFacebook.java:680) at com.sromku.simple.fb.SimpleFacebook.login(SimpleFacebook.java:255)

Any ideas?

Upvotes: 3

Views: 2085

Answers (1)

David Anderson
David Anderson

Reputation: 623

Just solved the issue.

Had to add

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
    mSimpleFacebook.onActivityResult(this, requestCode, resultCode, data); 
    super.onActivityResult(requestCode, resultCode, data);
} 

to my activity.

Upvotes: 6

Related Questions