Skip to content Skip to sidebar Skip to footer

Facebook Login Fails On Some Devices

I have implemented the Facebook login and it works fine on some devices/AVDs. My development device is a Gingerbread phone, but testing it with a 4.1.1 device, it simply does not l

Solution 1:

There is certainly a conflict between your stock app and the SDK. So if you don't want to uninnstall the stock HTC app and still use the SDK 3.0 I think your best bet without modying the source code of the sdk would be to disable SSO and login only through webview.

This can easily be done by adding the SessionLoginBehavior.SUPRESS_SSO everytime you try to open a new session. Here is a sample I changed from the SessionLoginSample (LoginUsingActivityActivity) from the Facebook SDK to show you what to do :

@OverridepublicvoidonCreate(Bundle savedInstanceState) {
    ...
    Sessionsession= Session.getActiveSession();
    if (session == null) {
        if (savedInstanceState != null) {
            session = Session.restoreSession(this, null, statusCallback, savedInstanceState);
        }
        if (session == null) {
            session = newSession(this);
        }
        Session.setActiveSession(session);

        //add the check, for if session is openedif (session.getState().equals(SessionState.CREATED_TOKEN_LOADED) || !session.getState().isOpened()) {
            //Add the suppress SSO behavior to force webview auth dialog to popup
            session.openForRead(newSession.OpenRequest(this).setCallback(statusCallback).setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO));
        }
    }
  ...
}
//then put your code in the statusCallback method or keep it in the session state change listener

Otherwise if you don't mind changing the facebook sdk code, you should check this out

Solution 2:

Shirley Facebook login is not broken on all 4.1.1 devices, so it is something with your implementation.

Are you sure the Key Hash is the same on that device as what you have configured on developer.facebook.com? If you used a different dev key, or it was installed by a third-party store, it's possible the key hashes don't match.

Turn on debug logging in the Facebook SDK source code and rebuild it. It is generally off by default for security reasons. Depending on your version of the SDK, it may be in Util.java or some other location, and may be a variable called 'ENABLE_LOG'.

Solution 3:

I think facebook login error mostly occur so to solve this issue you follow there tutorial step by step again with patience.

Other wise its very difficult to solve your problem here. So you can refer this link.

http://developers.facebook.com/android/

I hope you will success.

Solution 4:

There isn't enough info in your question. so, I'm making a few guesses here.

1)First look into Mike Venzke's answer.

2) If this doesn't work then try this: You need to sign in on you device using SSO (Single Sign On). So here are the steps you can take.

delete the build. reinstall it. and when asked for permissions from your device, allow them.

If you aren't taken back to your app then you need to add these to your manifest file:

<activityandroid:name="com.facebook.LoginActivity"android:label="@string/app_name" ></activity><meta-dataandroid:value="@string/app_id"android:name="com.facebook.sdk.ApplicationId"/>

where app_name and app_id are your respective app Id and app name on your Facebook app page.

Have you added these btw?

you need these permission as well

<uses-permissionandroid:name="android.permission.WAKE_LOCK"/><uses-permissionandroid:name="android.permission.GET_ACCOUNTS"/><uses-permissionandroid:name="android.permission.INTERNET" /><uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE" />

if you post some more info I might be guess the issue.

Solution 5:

I think the problem with your Facebook android app in device. So first uninstall the facebook android app from device and check that facebook login working properly or not.

Post a Comment for "Facebook Login Fails On Some Devices"