How can I open the Linkedin app from my Android app?

I easily open my facebook and twitter profile from my Android app:

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 do not know how the open linkedin application? Does anyone know the name of the Linkedin class?

Thanks guys!

+4
source share
3 answers

A LinkedIn application can be opened using Intents, but the API is not very well (generally?) Documented. Working URIs:

  • LinkedIn: // You
  • linkedin: // profile / [profile id]
  • linkedin: // group / [group id]

So you can 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 intentions from some time, but so far nothing has worked out. To get the profile ID, just go to the profile page and check the URL. To get the company ID, go to https://developer.linkedin.com/apply-getting-started#company-lookup .

+12
source

Try putStringExtra ("memberId", the_id ) in class com.linked.android.profile.ViewProfileActivity

0
source

Wieux answered this question, it was almost the right decision, he only had a typo, because of which his solution did not work. For some reason, someone deleted Wieux's answer and my correction. So I'm writing a 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, this solution is not complete, because it works only for people, not for companies, but I still do not understand all the different forms of URLs for links. This solution will only work if you have memberId as a number, you should put String, although not for long, as the memebr identifier.

Hope this helps.

0
source

All Articles