Android : Sharing multiple images to Facebook fails in Android

on Tuesday, July 29, 2014


I am trying to share multiple images located on the device to Facebook, using Intent.createChooser(). When only one image is shared, then it is displayed in the FB App Post Activity. When multiple images are being shared, then nothing (no images) is displayed in the FB App Post Activity. The same multiple images sharing works when Gmail, Yahoo Mail and Messenger are chosen instead of Facebook. Any ideas what might be going on here?


Thanks, Gary



mShareIntent = new Intent();
mShareIntent.setType("image/*");
mShareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

if (mImageUrls.size() == 1) {
Uri uri = Uri.fromFile(mShareFiles[0]);
mShareIntent.setAction(Intent.ACTION_SEND);
mShareIntent.putExtra(Intent.EXTRA_STREAM, uri);

} else {
mShareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
ArrayList<Parcelable> uris = new ArrayList<Parcelable>();

for(int i = 0; i < mImageUrls.size(); i++) {
uris.add(Uri.fromFile(mShareFiles[i]));
}
mShareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
}
mFragment.startActivity(Intent.createChooser(mShareIntent, "Share Images To...");

0 comments:

Post a Comment