Facebook - LoginFragment on SingleInstance activity

I am using Facebook SDK (4.3.0) LoginButton on a fragment that is hosted in Activity with launchMode set to singleInstance, facebook login button seems to have problems with this, since when clicking on it, the login action is canceled with this messege:

Cannot call LoginFragment with null caller packet. This can happen if the caller's startMode is singleInstance.

strange to note that this is not heppen on all devices, on most samsung devices it does, but my sony xperia does not suffer from this, anyway when I remove one instance run mode it works fine, but then my activity can have multiple instances that bring strange user experience to app users.

How do I fix this problem?

+3


source to share


1 answer


As noted in the post, caller class run mode in single instance or single point class.

My fix was to call the singleton class in the onResume () method instead of onCreate (@Nullable Bundle savedInstanceState).

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

    UserPresenter.getInstance().start(this);
}

      



In the same line of code, an error was made with onCreate when working with onResume.

Hope someone has a fix for the problem.

0


source







All Articles