문제

I realise this is a stupid question and needs to be deleted but stackoverflow wont let me since it has answers

I am trying to implement Login with facebook in my app using the UserSettingsFragment. The session status seems to be stuck at OPENING. It never moves on to OPEN. I have instantiated the fragment as follows

if(userSettingsFragment==null){
    userSettingsFragment=new UserSettingsFragment();
    Session session = Session.getActiveSession();
    if(session==null || session.isClosed()){
        userSettingsFragment.setPublishPermissions(Arrays.asList("publish_actions"));
    }
    userSettingsFragment.setSessionStatusCallback(new Session.StatusCallback(){
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            Log.i("LoginUsingFBMain", String.format("New session state: %s", state.toString()));
        }
    });
}
fragment=userSettingsFragment;
.
.
.
getFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment);
fragmentTransaction.commit();

and I also have code in place to catch the login result.

@Override
protected void onActivityResult(
        int requestCode, int resultCode, Intent data) {
    if(userSettingsFragment != null)
        userSettingsFragment.onActivityResult(requestCode, resultCode, data);
    uiHelper.onActivityResult(requestCode, resultCode, data);     


}
도움이 되었습니까?

해결책 2

Found the problem. My Hash was incorrect. A newer version of the sdk actually gave me an error message.

다른 팁

Have you overridden the onActivityResult() method inside the fragment? Try moving it to the Activity instead.

Facebook api hangs at "Opening" during openActiveSession

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top