i'm trying to call share method from the app's i want, not just call list of all app that allow sharing. I'm using this code to call twitter share:
String tweetUrl =
String.format("https://twitter.com/intent/tweet?text=%s&url=%s",
"Tweet text", "https://www.google.fi/");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(tweetUrl));
// Narrow down to official Twitter app, if available:
List<ResolveInfo> matches = getPackageManager().queryIntentActivities(intent, 0);
for (ResolveInfo info : matches) {
if (info.activityInfo.packageName.toLowerCase().startsWith("com.facebook")) {
intent.setPackage(info.activityInfo.packageName);
}
}
startActivity(intent);
This for facebook:
String fullUrl = "https://m.facebook.com/sharer.php?u=..";
try {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setClassName("com.facebook.katana",
"com.facebook.katana.ShareLinkActivity");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "your title text");
startActivity(sharingIntent);
} catch (Exception e) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(fullUrl));
startActivity(i);
}
But it calls just to open browser, not facebook app that's installed on phone
And don't know how to do it for Vk