Android: How can I force a facebook auth by mobile web

▼魔方 西西 提交于 2019-11-30 18:20:29

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/12084372/android-how-can-i-force-a-facebook-auth-by-mobile-web

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!