-5

I want to send a SMS to user as notification. How can we send SMS to a particular mobile number. Please also tell which service will be used for sending SMS.

Nitin Sharma
  • 100
  • 9

1 Answers1

0

In Android, you can use SmsManager API or device’s Built-in SMS application to send a SMS message.

For example:

SmsManager API

SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage("phoneNo", null, "sms message", null, null);

Built-in SMS application

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

both need SEND_SMS permission.

<uses-permission android:name="android.permission.SEND_SMS" />
Himanshu Agarwal
  • 4,623
  • 5
  • 35
  • 49