Question

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);     


}
Was it helpful?

Solution 2

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

OTHER TIPS

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

Facebook api hangs at "Opening" during openActiveSession

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top