I'd like to share a photo with caption pre-filled from my app via a share intent, on facebook.
I know how to share photo or how to share text, but how do I share them together?
Example code
Intent shareCaptionIntent = new Intent(Intent.ACTION_SEND);
shareCaptionIntent.setType("image/*");
//set photo
shareCaptionIntent.setData(examplePhoto);
shareCaptionIntent.putExtra(Intent.EXTRA_STREAM, examplePhoto);
//set caption
shareCaptionIntent.putExtra(Intent.EXTRA_TEXT, "example caption");
shareCaptionIntent.putExtra(Intent.EXTRA_SUBJECT, "example caption");
startActivity(Intent.createChooser(shareCaptionIntent,getString(R.string.share)));
If a set type to image/*
then a photo is uploaded without the caption prefilled. If a set it to text/plain
only the caption is uploaded without the photo.....
My guess is that the issue is that the Android Facebook App doesn't look for Intent.EXTRA_TEXT
when it filters an ACTION_SEND
Intent with type image/*
for photo uploading. So this issue could be resolved if the Android Facebook App looked for that value, and if present, inserted it as the caption of the image.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…