Question

I have a problem while trying to log in on Facebook for the second time. The first time the user enter its credentials, I start to upload some pictures in the background into its Facebook account.

However, in that period, another user can come and hit the Facebook button again. I expect that the previous request is still being processed, which is the case. However, I can't get the second user to log in WHILE THE FIRST PROCESSING (that is, the upload of the pictures of the first user) HAS NOT FINISHED YET.

What happens with the current version is that, when the second user hits my Facebook button, the Facebook API just assume that it refers to the previous user (because it is still running in the background). However, I want to start ANOTHER section with this new user, while the old one is still running in the background. How can I achieve that?

Here is my simple code (when the user hits my Facebook button on the screen, I call the following method):

 private void uploadPictures(View target) {

    mFacebook = new Facebook(getString(R.string.facebookappid));
    mAsyncRunner = new AsyncFacebookRunner(mFacebook);
    mFacebook.authorize(this, Settings.FACEBOOK_PERMISSIONS, Facebook.FORCE_DIALOG_AUTH, new LoginDialogListener());
}

PS: I have also tried to instantiate more than one Facebook and AsyncFacebookRunner objects, but it did not work (I get the same behaviour, that is, even though the objects are different, the login screen simply does not show up the second time (if the previous request is still being processed))!!!

Thank you so much in advance!

Was it helpful?

Solution

You're able to do something similar to this with the new 3.0 beta SDK. You can get it here and check out the SwitchUserSample.

You won't be able to use single sign-on (SSO) with the different users (they'll need to sign in via a webview dialog), but you'll get a different Session object that use can use for different users.

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