Sending SMS using Intents.

Quickly share your Android Code Snippets here...

Sending SMS using Intents.

Postby Jhon » Wed Feb 10, 2010 7:21 am

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", "Your Message");
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);

With above code we can easily launch the sms screen using intents.
Now just we give mobile number in To:Edit field.
Happy Journey
Jhon
Jhon
Freshman
Freshman
 
Posts: 9
Joined: Wed Sep 09, 2009 4:06 pm

Top

another method

Postby jarnaud » Mon Mar 01, 2010 9:43 pm

Here is another way:

SmsManager m = SmsManager.getDefault();
String destination = "xxxxxxxxxxx";
String text = "Hello, you!";
m.sendTextMessage(destination, null, text, null, null);

(from http://www.devandro.com)

-
Android training online videos: http://android.voxisland.com
Jay
jarnaud
Freshman
Freshman
 
Posts: 3
Joined: Tue Feb 09, 2010 7:14 pm

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 1 guest