Reputation: 369
The following lines should open the sms dialog in order to send a sms. On Api 19, the body is transmitted to the dialog, but on Lollipop, it remains blank.
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setType("vnd.android-dir/mms-sms");
sendIntent.putExtra("sms_body", bodySms);
context.startActivity(sendIntent);
Any idea ?
Upvotes: 0
Views: 722
Reputation: 369
With the Help of CommonsWare, this did the trick :
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setType("vnd.android-dir/mms-sms");
sendIntent.putExtra(Intent.EXTRA_TEXT, bodySms);
context.startActivity(sendIntent);
Upvotes: 2
Reputation: 1006944
The following lines should open the sms dialog in order to send a sms.
Not necessarily. What you are actually asking Android to do is to find an activity that handles ACTION_VIEW
on a MIME type of vnd.android-dir/mms-sms
. You are not asking to send an SMS.
Moreover, if you read the documentation for ACTION_VIEW
, you will not find a mention of an sms_body
extra.
If you want to send an SMS, use ACTION_SEND
with EXTRA_TEXT
or perhaps sms_body
.
Upvotes: 1