0

Using Intent.ACTION_SEND to share plain text or image. Everything works fine, the third party apps bottom sheet opens and I choose the sms application but I am not able to pass in the contact number in the intent. If I use share.putExtra("address", "9839098390") the message body becomes blank, and without using this flag everything works fine except the number recipient field is empty.
I have tried share.putExtra("address", "smsto:9839098390") and share.putExtra("mmsto:address", "9839098390") in both these cases the recipient field is filled with "9839060055" but the message body becomes empty.

Here's the code

Intent share = new Intent(Intent.ACTION_SEND);
share.putExtra(Intent.EXTRA_TEXT, message);
share.setType("text/plain");
if (contentUri != null && MIME_TYPE != null) {
      share.putExtra(Intent.EXTRA_STREAM, contentUri);
      share.setType(MIME_TYPE);
    }
if(phoneContact != null && !TextUtils.isEmpty(phoneContact.getId()))
share.putExtra("address", phoneContact.getId());
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
mContext.startActivity(Intent.createChooser(share, title));
  • Try this one may this will help you https://google-developer-training.github.io/android-developer-phone-sms-course/Lesson%202/2_p_sending_sms_messages.html @Ishita – Thakkar Darshan May 28 '20 at 09:15
  • @ThakkarDarshan that's different. that uses Intent.ACTION_SENDTO and that restricts to message app only. I am using Intent.Action_SEND – Ishita Garg May 28 '20 at 10:40

0 Answers0