Code for sending sms that worked perfectly until Android 4.3 (Jelly Bean) and stopped working since 4.4 (KitKat)
I'm just preparing the text message for the user, but they need to choose the number to send to.
The code I have used is:
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setData(Uri.parse("sms:"));
sendIntent.putExtra("sms_body", smsText);
activity.startActivity(sendIntent);
Since it stopped working, I have also tried the ACTION_SEND
and ACTION_SENDTO
Neither worked, I also tried the sendIntent.setType("vnd.android-dir/mms-sms");
, but again nothing worked.
I looked at several answers on Stack Overflow answer 1 and answer 2, but both answers aren't dealing with the requirements I have.
What I would like to do:
- Send sms with sms app only, not by all apps that serves the send intent
- Prepare the text for the user
- Let the user choose the phone number to send the message to
For moderators:
It is not a duplicate questions, since the questions, doesn't ask the exact same thing, the need here is to send sms with no phone number, and none of the questions and answers dealt with that.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…