send SMS via Intent - Android android.telephony

Android examples for android.telephony:SmsManager

Description

send SMS via Intent

Demo Code

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class Main {

  public static void sendSMS(Context cxt, String smsBody) {
    Uri smsToUri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);
    intent.putExtra("sms_body", smsBody);
    cxt.startActivity(intent);//www . j av a 2  s  . c  o m
  }

}

Related Tutorials