-1

Is there any way to send a text message without getting a confirmation? My current code for this is:

String phoneNumber = "1234567";
        Intent intent = new Intent(Intent.ACTION_SENDTO);
        intent.setData(Uri.parse("smsto:" + phoneNumber));  // This ensures only SMS apps respond
        intent.putExtra("sms_body", "TESTING TEXT MESSAGE! IT WORKS!");
        if (intent.resolveActivity(getPackageManager()) != null) {
            startActivity(intent);
        }
Tal C
  • 547
  • 1
  • 8
  • 17

1 Answers1

0

Yes you should use SmsManager. Here is an example:

SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage("phoneNo", null, "sms message", null, null);
Amir_P
  • 8,322
  • 5
  • 43
  • 92