Question

I have an app that integrates both Facebook and LinkdedIn networks. According to the instructions, in order to integrate LinkedIn, I need to add the following code in my manifest, within my activity:

<intent-filter>
   <action android:name="android.intent.action.VIEW" />
   <category android:name="android.intent.category.DEFAULT" />
   <category android:name="android.intent.category.BROWSABLE" />
   <data android:scheme="x-oauthflow-linkedin" android:host="callback" />
</intent-filter>

An example can also be found here. As you can see in the link, we need to add also the " android:launchMode="singleInstance" " line, otherwise after logging in with LinkedIn a new instance of the activity will be started.

However, when trying to log in to Facebook from the same activity, this actual line results to the following error from the Facebook Login activity (!):

E/AndroidRuntime(7100): Caused by: com.facebook.FacebookException: Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance.

So now, I'm somehow stuck, because removing android:launchMode="singleInstance" will make Facebook login working, but will cause the LinkedIn login to start another instance of my activity, but if I add it, then Facebook login is not working!

Does anyone have any idea how to address this issue?

Thank you,

Dimitris

Was it helpful?

Solution

After reading little bit on the documentation, it seems that replacing the singleInstance with singleTask did the trick. Although, I haven't figured out exactly why, I am posting this for others to see it in case someone needs it. I'll try to dig further and understand why, but in the mean time if anyone can explain why this is working, it would be nice.

OTHER TIPS

This sdk can integrate you to handle both facebook and linkedin without any hassle. Also use valid url for linkedin callback.

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