dksxogudsla
dksxogudsla

Reputation: 21

How can I execute default sms app?

I registered my receiver to get SMS. When I receive SMS's, how can I execute the phone's default SMS app?

Can I use the intent send action to start the default SMS app?

Upvotes: 2

Views: 710

Answers (2)

Gulmina Khan Khattak
Gulmina Khan Khattak

Reputation: 51

Here "number" is an array of strings with the numbers of contacts to whom you want to send sms to and "älldetails" is teh string you want to send. 


 String n = "";
for(int i = 0; i<sizesf ;i++)
{
        if(i == (sizesf-1))
        {

            n = n + number[i];
        }

        else 
            n = n + number[i] + ";";

}  


Log.d("numbers in intent", n);

Intent smsIntent = new Intent( Intent.ACTION_VIEW, Uri.parse( "smsto:"+ n) );
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.putExtra("address", n );
smsIntent.putExtra("sms_body",alldetails);
startActivity(smsIntent);

}

Upvotes: 0

Bill Mote
Bill Mote

Reputation: 12823

It can be done in a couple of different ways. Here's one:

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", "Content of the SMS goes here..."); 
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);

Upvotes: 1

Related Questions