I open facebook and twitter profile easily from my android application like this:
if (facebookId != null)
{
try
{
long longFacebookid = Long.parseLong(facebookId);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.facebook.katana", "com.facebook.katana.ProfileTabHostActivity");
intent.putExtra("extra_user_id", longFacebookid);
startActivity(intent);
return;
}
catch (ActivityNotFoundException e)
{
e.printStackTrace();
}
catch (NumberFormatException e)
{
e.printStackTrace();
}
}
But I don't know how open linkedin application? Does somebody know the class name of Linkedin?
Thanks guys!
The LinkedIn app may be opened using Intents, but the API is not very well (at all?) documented.
The working URIs are:
- linkedin://you
- linkedin://profile/[profile id]
- linkedin://group/[group id]
So you may use:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("linkedin://you"));
final PackageManager packageManager = getContext().getPackageManager();
final List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (list.isEmpty()) {
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.linkedin.com/profile/view?id=you"));
}
startActivity(intent);
I'm trying to open a company profile using intents since some time but no result yet.
To obtain the profile id just visit the profile page and check the URL.
To get the company id go to https://developer.linkedin.com/apply-getting-started#company-lookup.
Try putStringExtra("memberId", the_id
) on the class com.linked.android.profile.ViewProfileActivity
Wieux answered to this question was almost the right solution, he only had a typo that caused his solution not to work. From some reason somebody deleted Wieux's answer, and my correction. Therefor I'm writing the solution again.
Intent linkedinIntent = new Intent(Intent.ACTION_VIEW);
linkedinIntent.setClassName("com.linkedin.android", "com.linkedin.android.profile.ViewProfileActivity");
linkedinIntent.putExtra("memberId", <member id>);
startActivity(linkedinIntent);
That is it, this solution is not complete, since it work only for people and not for companies, I also still don't understand all the different forms of url for linkedin. This solution would work only if you have the memberId in the form of number, you should put String though and not long as the memebr id.
Hope it helps.