Currently, I wanted to send app generated PDF or Excel file from WhatsApp with text. But after opening chat screen only file getting sends and not a text. Same code working for email client where text gets added as a body
Intent intentShareFile = new Intent(Intent.ACTION_SEND);
intentShareFile.putExtra(Intent.EXTRA_SUBJECT,
"My Subject");//Only used if user selects email client
intentShareFile.putExtra(Intent.EXTRA_TEXT,
"Extra text");
if (isReportInPDF())
intentShareFile.setType("application/pdf");
else
intentShareFile.setType("application/vnd.ms-excel");
intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + url));
startActivity(Intent.createChooser(intentShareFile, "Share File"));
If you supply both extras, it is up to the consuming app to decide what to do with them and not all apps will use both.
As Per this comment.