Launching SMS message intent no longer works for the new Droid RAZR ICS operating system

Launching an SMS message intent (composing pre-filled text) no longer works for the new Droid RAZR ICS operating system. Are there other ways to solve this problem?

I 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 a text message is not pre-populated until it behaves correctly for all other devices and operating systems, as far as I know.

+6
source share
2 answers

Use ACTION_SENDTO with smsto: Uri for the phone number to which you want to send a message.

The type of MIME that you use is undocumented and therefore can be changed as desired by the core group of Android developers or devices.

+1
source

I ran into this problem and finally concluded that the string "sms_body" 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 works on both Android 2.x and Android 4.0, although I can not find the documentation that supports it. I decided to go with the "sms:" URI rather than using the mime type, since the mime type is unfortunately non-standard.

+1
source

Source: https://habr.com/ru/post/919883/


All Articles