I'm trying to write an app that sends SMS messages. To do this, I use the following code:
Intent smsIntent = new Intent(Intent.ACTION_SENDTO);
smsIntent.setData(Uri.parse("sms:" + number));
smsIntent.putExtra("sms_body", message);
smsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(smsIntent);
The problem is: when I run it, it shows me a dialog and I need to choose with which app I want to send the message (WhatsApp/Hangouts/Messaging/etc.) and when I choose "Messaging", it only prepares the message and waits for me to press "send". How can I send the message immediately through "Messaging" (without the dialog and without waiting until "send" is pressed)?