0
我試圖應用找到的解決方案here,但我只有鏈接的配置文件的URL,而不是ID。該代碼最終總是Ø如何在不知道配置文件ID的情況下從我的應用打開LinkedIn應用?
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);
}