Send SMS Messages Using Intent

Description

To invoke the built-in Messaging application and let it do all the work of sending the message. you can use an Intent object together with the MIME type "vnd.android-dir/mms-sms".

The following code shows how to Send SMS Messages Using Intent.

Example


Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.putExtra("address", "5556; 5558; 5560");
//  www .  j  a  v  a  2  s .c o m
i.putExtra("sms_body", "Hello my friends!");
i.setType("vnd.android-dir/mms-sms");
startActivity(i);

Note

You can send your SMS to multiple recipients by simply separating each phone number with a semi-colon in the putExtra() method.

The numbers will be separated using commas in the Messaging application.

If using this method to invoke the Messaging application, there is no need to declare SEND_SMS permission in AndroidManifest.xml.





















Home »
  Android »
    Android Basics »




Hello Android
Resources
Activity
Calendar
Camera
Contact
Content Provider
Database
Hardware
Intent
Location
Media
Network
Notification
Preference
Sensor
Service
SMS