John Ng
John Ng

Reputation: 899

Facebook SDK feed dialog doesn't work in Android SDK 2.1 and lower

I'm trying to implement a share to Facebook functionality in my Android app and having problems with making it work in the emulator using Android SDK versions 2.1 and lower.

The sample HackBook and my app works fine but when I try it in a lower SDK version (2.1 and lower) the dialog sometimes appears for a while and just disappears. Or sometimes, it doesn't show up at all. The "Get Friends" function in HackBook works fine though, but you can't post anything on your friends wall.

I never saw anything on the Facebook page that it requires at least Android SDK 2.2 or maybe I'm just missing it. Does anybody know how I can make the Facebook SDK feed dialog work on at least 2.1 devices?

EDIT: This is how I login in Facebook. I do not use SSO. I want everything to be in dialog.

facebook.authorize(activity, permissions, Facebook.FORCE_DIALOG_AUTH, new LoginDialogListener());

ADDITIONAL INFO:

During log-in, when the dialog for asking permission shows up, it disappears also after a few seconds. The only dialog that doesn't seem to disappear and I can interact with is the login page. There are no exceptions in logcat. Only happens in Android 2.1 and lower.

UPDATE: Spent 2 days trying to figure this out. Until finally, I got hold of an Android phone with firmware version 2.1-update 1 and it works fine. The problem must be with the emulator.

I don't exactly know what's wrong with the emulator, but it appears that I have proper internet connection cause I can browse Facebook in the Android browser.

This just means that it's gonna be hard for me to test my apps in different Android platforms since I can't really trust the emulator.

Upvotes: 0

Views: 901

Answers (1)

Manikandan
Manikandan

Reputation: 1519

Follow these steps.

Step 1: if you use like this...

authenticatedFacebook.authorize(Activity.this,PERMISSIONS, new TestLoginListener());

change it to..

authenticatedFacebook.authorize(Activity.this,PERMISSIONS, -1, new TestLoginListener());

Step 2:

Change DEFAULT_AUTH_ACTIVITY_CODE to FORCE_DIALOG_AUTH in the both the authorize methods in Facebook.java class of the Facebook SDK.

Now you will get the issue fixed. Clean and run. You can login an successfully post to Facebook.

Upvotes: 1

Related Questions