4

I am sending mms via android intent. I am adding the code. Please review

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(intent.EXTRA_TEXT, "Test message");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/storage/emulated/0/testmessage.jpg")));
intent.setType("image/jpeg");
startActivity(intent);

My problem is, How we can add recipients? I am trying this in my code

intent.putExtra("address", "045263299");

When i add this line, the number will show but the image and text will be disappear. I want to add image, text and phone number and send mms through intent. Thanks

Umair_UAS
  • 113
  • 1
  • 10

1 Answers1

0

Too late for you but could be useful to someone else.

Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setData(Uri.parse("mmsto:"+ phoneNumber));
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.putExtra(intent.EXTRA_TEXT, text);
if (intent.resolveActivity(activity.getPackageManager()) != null)
{
  activity.startActivity(intent);
}
anemomylos
  • 546
  • 1
  • 6
  • 14