A Guide to Mobile and Web Technology(LAMP)

The following lines of code are used to send sms from android phones. This will launch the default sms intent with a message

“Hi this is test sms”

and allows to enter the phone number and edit the message if necessary!

//call the default intent to launch message compose page

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
//use to fill the sms body
sendIntent.putExtra("sms_body", "Hi this is test sms"); 
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
Advertisements

Comments on: "How to send Sms from Android Programatically" (3)

  1. is there any way to specify the phone number while opening SMS client ??

  2. i love to read tech blogs because i am a technology addict, always looking for new hi tech stuffs ..

  3. Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(“phonenumber”));

    intent.putExtra(“sms_body”, body);

    intent.putExtra(“compose_mode”, true);

    This code will automatically prefill the number and body of the sms

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: