I'm trying to implement sending an SMS from an Android app with a predefined text message. I'm using the native chooser activity by doing:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
String[] phoneNumber = {selectedContact.getPhoneNumber()};
intent.putExtra(Intent.EXTRA_TEXT, getResources().getString(R.string.contact_message_body));
intent.putExtra(Intent.EXTRA_PHONE_NUMBER, phoneNumber);
startActivity(Intent.createChooser(intent, "Send Message"));
The phone number is indeed stored in the phoneNumber variable, but when testing it, it's not being passed over to the recipient field for the Messages option. So the EXTRA_TEXT info fills the new SMS but the recipient is empty.
I've seen others use Intent.ACTION_SEND but this will not work in my case, because I also have to implement Email sending from the same chooser.
Appreciate the help!