Mar 22, 2011

Send SMS by startActivity with Intent.ACTION_SENDTO

Here is a example by calling startActivity() with Intent.ACTION_SENDTO. Android default SMS app will be started to send SMS with pre-defined text and number.

remark: change "xxxxxxxx" to the number of the phone to receive SMS.

        Uri uri = Uri.parse("smsto:xxxxxxxx");  
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra("sms_body", "SMS text");
startActivity(intent);




No comments:

Post a Comment

Infolinks In Text Ads