Home > Software design >  How to send messages with Android Studio-Java
How to send messages with Android Studio-Java

Time:11-29

my question is about Android Studio, in case someone knows how to open the message application that the android device brings to send a message when clicking on a button... I have an application developed in Android Studio with Java, which It registers contacts and I want that when a button is pressed that is to send messages, the application takes the phone number of the person to whom the button belongs and opens the phone messages application.

I already did the function of making the call, but I couldn't find examples that help me for what I want to do... I hope someone has some idea and helps me, thank you very much in advance.

CodePudding user response:

String number = "12346556";  // The number 
startActivity(new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", number, null)));

CodePudding user response:

you can try SMS manager api:

SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTestMessage("phone number", null, "message content", null, null);
  • Related