Question

I'm trying to open Linkedin profile with an app in Android, with a URL or member id.
I try this:

Intent linkedinIntent = new Intent(Intent.ACTION_VIEW);
linkedinIntent.setClassName("com.linkedin.android", "com.linkedin.android.profile.ViewProfileActivity");
linkedinIntent.putExtra("memberId", <member id>);
startActivity(linkedinIntent);

but this code just opens the Linkedin app.
How can I open the specific profile?

Was it helpful?

Solution 3

According to posts on the LinkedIn Developer forums, this functionality is not exposed by their API.

Sources:

  1. http://developer.linkedin.com/forum/android-intent
  2. http://developer.linkedin.com/forum/mobile-user-profile-url

However, there is an undocumented method which seems to work. Naturally, it may have an oversight on their part to have left it open for use and making of use this naturally comes with the warning since it is undocumented, it may or may not change. If it does change, it may break the functionality of your app

With that said, the suggestion from one of LinkedIn's employee here: https://developer.linkedin.com/comment/3614#comment-3614 has disclosed the above undocumented feature.

http://www.linkedin.com/x/profile/{consumer-key}/{member-token}

Good luck and hopefully, LinkedIn will make such a feature (simple and somehow, still ignored) available via their API.

OTHER TIPS

try {
          getPackageManager().getPackageInfo("com.linkedin.android", 0);
          intent = new Intent(Intent.ACTION_VIEW, Uri.parse("linkedin://profile/yourID"));
    }catch (Exception e) {
            showerror(); // handle exception
    }finally {
        startActivity(intent);
}

Just navigating to the link as a website is letting the user to choose between LinkedIn app and web browsers. With:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
context.startActivity(intent);

Tested on Android API 28

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