3

I want to develop the android app with facebook authentication. But if the phone has facebook application in it, I cannot auth on my app, if not, it works well.

so, i want to force a facebook authentication by mobile web without facebook application.

Only if I use authorize(. , .)in application, it uses facebook app directly.

How can I fix this problem??

additionally, Hackbook(https://developers.facebook.com/docs/mobile/android/hackbook/) also doesn't work if I auth by facebook app. I cannot login on app.

/////comment

I found the answer by myself

Change the authorize function in facebook.java in facebook sdk.

public void authorize(Activity activity, final DialogListener listener) {
    authorize(activity, new String[] {}, FORCE_DIALOG_AUTH,
            listener);
}

/**
 * Authorize method that grants custom permissions.
 *
 * See authorize() below for @params.
 */
public void authorize(Activity activity, String[] permissions,
        final DialogListener listener) {
    authorize(activity, permissions, FORCE_DIALOG_AUTH, listener);
}

now it works!

Yongsoo Lee
  • 41
  • 2
  • 7
  • Just for the record. if anyone is trying to solve the somewhat infamous "Unity3D Facebook, hash is wrong" issue {the approach here is one solution}, there's now a solution: ttp://answers.unity3d.com/questions/609810/using-facebook-api-with-android-says-login-is-canc.html – Fattie May 05 '14 at 16:00

1 Answers1

4

When you use Facebook SDK 3.0 and the login button the best way to force this is setting a LoginBehavior to the LoginButton. This can be done like this:

LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton);
authButton.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);

Source: Android - Force Facebook connexion - Stack Overflow

Community
  • 1
  • 1
John Smith
  • 96
  • 9