1

Its working perfectly on emulator but not on device.
crashing at response = read(conn.getInputStream()); in facebook sdk.

Jason Wood
  • 737
  • 1
  • 13
  • 22

1 Answers1

2

Yeah I had this issue,

It worked fine on the emulator, worked fine on my dev phone, but failed on the test users phone.

It's to do with the Facebook app and SSO.

Have a read of this : http://sean.lyn.ch/2011/07/android-the-facebook-sdk-sso-and-you/

It has 3 solutions.

I couldn't get SSO to work so I went for option two, (opt out of SSO!) This is done by:

facebook.authorize(this, PERMISSIONS, Facebook.FORCE_DIALOG_AUTH, this); If you want to fix it and get SSO to work:

Correctly generate your hash key for the debug apk certificate. (detailed in the link above).

Ref:

https://stackoverflow.com/a/7158056/1838457

Community
  • 1
  • 1
Android Developer
  • 1,039
  • 1
  • 9
  • 33
  • 2
    Using `FORCE_DIALOG_AUTH` is **not recommended** as it **may open up your app to malicious apps that can steal your user's Facebook credentials** (SOURCE: Answer by *Jesse Chen*, who works at Facebook. http://stackoverflow.com/a/12433933/450534. – Siddharth Lele Nov 26 '12 at 13:28