Skip to content
This repository has been archived by the owner on Aug 3, 2019. It is now read-only.

Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance. #23

Open
pangminfu opened this issue Oct 24, 2013 · 11 comments
Assignees

Comments

@pangminfu
Copy link

I get this error:

10-24 16:21:35.737: E/com.facebook.LoginActivity(20573): Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance.

for your information implementing your sample in a tabgroup activity

Thank you

@sromku
Copy link
Owner

sromku commented Oct 24, 2013

Hi,

Have you added these lines to your manifest under application tag?

<activity
            android:name="com.facebook.LoginActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

@pangminfu
Copy link
Author

yes i had added in.

for your information, i found this in facebook sdk LoginActivity.java :

@Override
public void onResume() {
    super.onResume();

    // If the calling package is null, this generally means that the callee was started
    // with a launchMode of singleInstance. Unfortunately, Android does not allow a result
    // to be set when the callee is a singleInstance, so we log an error and return.
    if (callingPackage == null) {
        Log.e(TAG, NULL_CALLING_PKG_ERROR_MSG);
        finish();
        return;
    }

    authorizationClient.startOrContinueAuth(request);
}

@sromku
Copy link
Owner

sromku commented Oct 24, 2013

From stack overflow, it seems as this is a known issue of tabs+social integration.
I will make some tests to find out what can be done here.

@pangminfu
Copy link
Author

yes. I think that the problem was caused by tab group activity. because when i change my project launcher activity to my fb login activity which does not have a tab, the code is working find.

@sromku
Copy link
Owner

sromku commented Oct 24, 2013

@pangminfu thank you for raising this issue. I hope that the solution won't have to change the original facebook sdk and everything could be done on high level. I will check and update you.

@pangminfu
Copy link
Author

Thanks for your fast response.

for your information, even i change to implement a "com.facebook.widget.LoginButton" i still get the same error message.

same condition, login is working when i change my project launcher activity to my fbloginactivity which does not have a tab.

thank you very much

@ghost ghost assigned sromku Oct 31, 2013
@jonathanrz
Copy link

I have the same problem, but the problem only occur with two conditions:

1-I have the Facebook app installed.
2-I have login, logout and I'm trying to login again.

@tlslaj0417
Copy link

Hi sromku, just want to share some idea, I have met this issue before when I am logout and login again, and I am thinking of I am actually using a helper class with singleton method to your library.
I fixed this by setting "null" to my instance everytime user logout facebook. So maybe you can add in the release instance method to clear or remove the previous instance every time user was logged out.

Just sharing. Thanks. Hope it helped

@tlslaj0417
Copy link

And I also faced same issue when I am doing request new permission, so I added 1 more argument on the simplefacebook for "activity", so that the facebook session can update with my new and current activity context.
Configuration.activity = activity
at requestNewPermissions in SessionManager class

@jonathanrz
Copy link

@tlslaj0417 I had a singleton wrapping FacebookUiHelper and recreating the singleton object resolved for me too. Thanks!

@shoaibakram-regexsoft
Copy link

Hi can anyone fix this issue I'm also facing it and didn't find any valuable answer. it is producing in sharing post on fb without dialogue box. and works fine with dialogue box ... :(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants