如何在不知道个人资料ID的情况下从我的应用程序打开LinkedIn应用程序?

时间:2015-07-21 18:56:07

标签: android android-intent linkedin social-networking

我尝试应用找到here的解决方案,但我只拥有linkedIn配置文件的网址,而不是ID。此代码总是以

结尾
String username = "bill-johnson"; // this is inferred from the full URL

public void toLinkedIn(){
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("linkedin://" + username));
        final PackageManager packageManager = getPackageManager();
        final List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
        if (list.isEmpty()) {
                // fall back on the full URL, which I also know.
                intent = new Intent(Intent.ACTION_VIEW, Uri.parse(LINKEDIN_URL));
        }
        startActivity(intent);
    }

1 个答案:

答案 0 :(得分:0)

LinkedIn的Android SDK提供了一个功能,可以直接在官方LinkedIn应用程序中“直接链接”个人资料。我建议您查看一下:https://developer.linkedin.com/docs/android-sdk#deeplink