0

我有一个 android 应用程序,我们正在使用新的 Facebook SDK(版本 3.0.1)。我的许多用户无法使用 Facebook 登录。单击 Facebook 登录按钮后,它会打开 FacebookLoginActivity并永远停留在那里。


            /**My Activity **/
            public class RegisterActivity extends FragmentActivity{

            @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);        
                    setContentView(R.layout.register);

                    if (savedInstanceState == null) {
                        // Add the fragment on initial activity setup
                        mainFragment = new RegistrationFragment();
                        getSupportFragmentManager()
                        .beginTransaction()
                        .add(android.R.id.content, mainFragment)
                        .commit();
                    } else {
                        // Or set the fragment from restored state info
                        mainFragment = (RegistrationFragment) getSupportFragmentManager()
                                .findFragmentById(android.R.id.content);
                    }
            ...
            }

                    public void onStart() {

                    mainFragment.initialize(this,R.layout.register,false);
                    super.onStart();

                }
                ...
            }
            /**My Fragment **/
            public class RegistrationFragment extends Fragment{
            @Override
                public void onCreate(Bundle savedInstanceState) {

                    super.onCreate(savedInstanceState);
                    uiHelper = new UiLifecycleHelper(getActivity(), callback);
                    uiHelper.onCreate(savedInstanceState);
                }
                private void onSessionStateChange(Session session, SessionState state, Exception exception) {


                    if(state == SessionState.OPENING){

                        registrationManager.updateState(FlurryAccess.REGISTRATION_FACEBOOK_LOGIN_START,flurryParams);
                        registrationManager.startLogin();
                    }
                    else if (state.isOpened()) {

                        registrationManager.updateState(FlurryAccess.REGISTRATION_FACEBOOK_LOGIN_LOGGED_IN,flurryParams);

                        if(!sentRequest){
                            sentRequest = true;
                            makeMeRequest(session);
                        }

                    } else if (state.isClosed()) {

                    }
                }
                private Session.StatusCallback callback = new Session.StatusCallback() {
                    @Override
                    public void call(Session session, SessionState state, Exception exception) {
                        onSessionStateChange(session, state, exception);
                    }
                };
                    @Override
                public void onActivityResult(int requestCode, int resultCode, Intent data) {
                    super.onActivityResult(requestCode, resultCode, data);

                    uiHelper.onActivityResult(requestCode, resultCode, data);
                }

        @Override
    public View onCreateView(LayoutInflater inflater, 
            ViewGroup container, 
            Bundle savedInstanceState) {

        final View view = inflater.inflate(layoutRes, container, false);

        LoginButton authButton = (LoginButton) view.findViewById(R.id.facebook_login);


        authButton.setFragment(this);
...
}
                     ...
            }
4

0 回答 0