I'm trying to share some text and 2 images in Twitter via Android Native Intent share. I tried with the below code.
ArrayList<Uri> uris = new ArrayList<Uri>();
Uri u1 = Uri.fromFile(new File("LOCATION OF THE FILE"));
Uri u2 = Uri.fromFile(new File("LOCATION OF THE FILE"));
uris.add(u1);
uris.add(u2);
Intent share = new Intent(Intent.ACTION_SEND_MULTIPLE);
share.setType("*/*");
share.putExtra(Intent.EXTRA_TEXT, "Share Text");
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
share.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
share.setPackage("com.twitter.android");
context.startActivity(share);
with the above code i cannot able to attach the two images. But the same code works for the Email Share. I could able to attach two images to the email client with no issues. But with twitter i'm facing problem.
My summary of questions: When i try to attach single image it works fine. But not when attaching more than 1 comes the problem.
Does twitter support uploading more than two images at the time through native intent share?
When using "Intent.ACTION_SEND" - Twitter app appears for sharing. But when i use "Intent.ACTION_SEND_MULTIPLE" - Twitter app is not listed.
No it does not support Intent.ACTION_SEND_MULTIPLE.
As it doesn't support Intent.ACTION_SEND_MULTIPLE, It will not get listed.
I have latest version of Twitter Official App installed in my device. My Device running Android 5.1. But even tried with 4.2 problem exists. When using "Intent.ACTION_SEND_MULTIPLE" app crashes. Log says "Activity not found exception" even though the app is installed
Before firing the intent check weather there is any application to handle it, to avoid the crash.
List<ResolveInfo> resolveInfoList = getPackageManager()
.queryIntentActivities(sendIntent, 0);