In the below example code I have clearly described,how you can share your app page url used by Intent in Linkedin.Here I have used putExtra method to add url.And I have also used activity info and package name .
private void shareOnlinkedin() {
Intent linkedinIntent = new Intent(Intent.ACTION_SEND);
linkedinIntent.setType("text/plain");
linkedinIntent.putExtra(Intent.EXTRA_TEXT, referralUrl); //here I have added app page url .
boolean linkedinAppFound = false; //check app insall in your phone .
List<ResolveInfo> matches2 = getActivity().getPackageManager()
.queryIntentActivities(linkedinIntent, 0);
for (ResolveInfo info : matches2) {
if (info.activityInfo.packageName.toLowerCase().startsWith( //added packageName & className
"com.linkedin")) {
linkedinIntent.setPackage(info.activityInfo.packageName);
linkedinAppFound = true;
break;
}
}
if (linkedinAppFound) {
startActivity(linkedinIntent);
}
else
{
Toast.makeText(getContext(),"LinkedIn app not Insatlled in your mobile",Toast.LENGTH_LONG).show();
}
}
0 Comment(s)