starting an SMS message intent (compose pre-populated text) is no longer working for new Droid RAZR ICS operating system. Are there other ways to accomplish this task?
I have tried both:
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", smsBody);
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
Also tried,
Uri.parse(uri);
The body of the text message is not pre-populating meanwhile it behaves correctly for all other devices and operating systems to my knowledge.
I ran into this problem as well, and eventually concluded the "sms_body" string is no longer applicable in Android 4; instead the more logical Intent.EXTRA_TEXT key is used.
String text = "Hello world";
i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("sms:"));
// i.setType("vnd.android-dir/mms-sms");
i.putExtra(Intent.EXTRA_TEXT, text);
i.putExtra("sms_body", text);
startActivity(i);
This code appears to work in both Android 2.x and Android 4.0, although I can find no documentation supporting it. I chose to go with the "sms:" URI rather than using a mime-type, since the mime type appears to be unfortunately nonstandardized.
Use ACTION_SENDTO
with a smsto:
Uri
for the phone number that you want to send the message to.
The MIME type you are using is undocumented and therefore subject to change, at will, by the core Android team or device manufacturers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With