i want to open a url from my app, that is "http://www.linkedin.com/company/company-name", If LinkedIn app is installed, need to launch the app. Otherwise, open the url by launch a browser. My code is like below `
public void launchLinkedIn()
{
final String urlFb = "linkedin://" + pageId;
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(urlFb));
final PackageManager packageManager = activity.getPackageManager();
List<ResolveInfo> list = packageManager.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
if (list.size() == 0) {
final String urlBrowser = "http://www.linkedin.com/company/" + pageId;
intent.setData(Uri.parse(urlBrowser));
}
activity.startActivity(intent);
}
`
Now this code is invoke directly to browse even i have linkedin app.. Please help anyone for me. Thanks in advance.