I am trying to automatically send SMS message to a certain number when the user presses a button on the screen.
This is my code:
Intent smsIntent = n
Try this
private static final String SMS_SENT_INTENT_FILTER = "com.yourapp.sms_send";
private static final String SMS_DELIVERED_INTENT_FILTER = "com.yourapp.sms_delivered";
String message = "hey, this is my message";
String phnNo = " " //preferable use complete international number
PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(
SMS_SENT_INTENT_FILTER), 0);
PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(
SMS_DELIVERED_INTENT_FILTER), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phnNo, null, message, sentPI, deliveredPI);