I want to open the URL of my application, that is, " http://www.linkedin.com/company/company-name ", if the LinkedIn application is installed, you need to start the application. Otherwise, open it by launching the browser. My code is as follows: `
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 called directly for viewing, even if I have a related application .. Please help someone for me. Thanks in advance.
source
share