Launching Messaging application with a body text

2019-07-04 01:38发布

问题:

i have this code to open the messaging. i wanna add body text into it

            Intent i6 = new Intent(Intent.ACTION_VIEW, Uri
                    .parse("sms:9986377561"));
            startActivity(i6);

add body text

body: test text

回答1:

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", "The SMS text"); 
sendIntent.putExtra("address", "phoneNumber1;phoneNumber2;...");
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);